diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2ba6e51c77..29f036323a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,66 +1,66 @@ -name: ReleaseWorkflow -# - Gets artifacts from S3 -# - Sends it to JFROG Artifactory -# - Adds them to the release assets +# name: ReleaseWorkflow +# # - Gets artifacts from S3 +# # - Sends it to JFROG Artifactory +# # - Adds them to the release assets -on: # yamllint disable-line rule:truthy - release: - types: - - published +# on: # yamllint disable-line rule:truthy +# release: +# types: +# - published -jobs: - ReleasePublish: - runs-on: [self-hosted, style-checker] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - JFROG_API_KEY=${{ secrets.JFROG_KEY_API_PACKAGES }} - TEMP_PATH=${{runner.temp}}/release_packages - REPO_COPY=${{runner.temp}}/release_packages/ClickHouse - EOF - - name: Check out repository code - uses: actions/checkout@v2 - with: - # Always use the most recent script version - ref: master - - name: Download packages and push to Artifactory - run: | - rm -rf "$TEMP_PATH" && mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY" - python3 ./tests/ci/push_to_artifactory.py --release "${{ github.ref }}" \ - --commit '${{ github.sha }}' --all - - name: Upload packages to release assets - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.temp}}/push_to_artifactory/* - overwrite: true - tag: ${{ github.ref }} - file_glob: true - ############################################################################################ - ##################################### Docker images ####################################### - ############################################################################################ - DockerServerImages: - runs-on: [self-hosted, style-checker] - steps: - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise we will have no version info - - name: Check docker clickhouse/clickhouse-server building - run: | - cd "$GITHUB_WORKSPACE/tests/ci" - python3 docker_server.py --release-type auto --version "${{ github.ref }}" - python3 docker_server.py --release-type auto --version "${{ github.ref }}" --no-ubuntu \ - --image-repo clickhouse/clickhouse-keeper --image-path docker/keeper - - name: Cleanup - if: always() - run: | - docker kill "$(docker ps -q)" ||: - docker rm -f "$(docker ps -a -q)" ||: - sudo rm -fr "$TEMP_PATH" +# jobs: +# ReleasePublish: +# runs-on: [self-hosted, style-checker] +# steps: +# - name: Set envs +# run: | +# cat >> "$GITHUB_ENV" << 'EOF' +# JFROG_API_KEY=${{ secrets.JFROG_KEY_API_PACKAGES }} +# TEMP_PATH=${{runner.temp}}/release_packages +# REPO_COPY=${{runner.temp}}/release_packages/ClickHouse +# EOF +# - name: Check out repository code +# uses: actions/checkout@v2 +# with: +# # Always use the most recent script version +# ref: master +# - name: Download packages and push to Artifactory +# run: | +# rm -rf "$TEMP_PATH" && mkdir -p "$TEMP_PATH" +# cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" +# cd "$REPO_COPY" +# python3 ./tests/ci/push_to_artifactory.py --release "${{ github.ref }}" \ +# --commit '${{ github.sha }}' --all +# - name: Upload packages to release assets +# uses: svenstaro/upload-release-action@v2 +# with: +# repo_token: ${{ secrets.GITHUB_TOKEN }} +# file: ${{runner.temp}}/push_to_artifactory/* +# overwrite: true +# tag: ${{ github.ref }} +# file_glob: true +# ############################################################################################ +# ##################################### Docker images ####################################### +# ############################################################################################ +# DockerServerImages: +# runs-on: [self-hosted, style-checker] +# steps: +# - name: Clear repository +# run: | +# sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" +# - name: Check out repository code +# uses: actions/checkout@v2 +# with: +# fetch-depth: 0 # otherwise we will have no version info +# - name: Check docker clickhouse/clickhouse-server building +# run: | +# cd "$GITHUB_WORKSPACE/tests/ci" +# python3 docker_server.py --release-type auto --version "${{ github.ref }}" +# python3 docker_server.py --release-type auto --version "${{ github.ref }}" --no-ubuntu \ +# --image-repo clickhouse/clickhouse-keeper --image-path docker/keeper +# - name: Cleanup +# if: always() +# run: | +# docker kill "$(docker ps -q)" ||: +# docker rm -f "$(docker ps -a -q)" ||: +# sudo rm -fr "$TEMP_PATH" diff --git a/.github/workflows/release_branches.yml b/.github/workflows/release_branches.yml index 272aabf8628..600913802f1 100644 --- a/.github/workflows/release_branches.yml +++ b/.github/workflows/release_branches.yml @@ -5,11 +5,21 @@ env: PYTHONUNBUFFERED: 1 on: # yamllint disable-line rule:truthy +# pull_request: +# types: +# - synchronize +# - reopened +# - opened +# branches: +# - '**/22.3*' +# release: +# types: +# - published +# - prereleased push: branches: - # 22.1 and 22.10 - - '2[1-9].[1-9][0-9]' - - '2[1-9].[1-9]' + # any 22.3 family release + - 'releases/22.3*' jobs: DockerHubPushAarch64: @@ -108,9 +118,9 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" -######################################################################################### -#################################### ORDINARY BUILDS #################################### -######################################################################################### + ######################################################################################### + #################################### ORDINARY BUILDS #################################### + ######################################################################################### BuilderDebRelease: needs: [DockerHubPush] runs-on: [self-hosted, builder] @@ -124,6 +134,7 @@ jobs: CACHES_PATH=${{runner.temp}}/../ccaches CHECK_NAME=ClickHouse build check (actions) BUILD_NAME=package_release + CLICKHOUSE_STABLE_VERSION_SUFFIX=altinitystable EOF - name: Download changed images uses: actions/download-artifact@v2 @@ -133,12 +144,15 @@ jobs: - name: Clear repository run: | sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" + - name: Trust My Directory + run: git config --global --add safe.directory * # https://stackoverflow.com/a/71940133 - name: Check out repository code uses: actions/checkout@v2 with: fetch-depth: 0 # otherwise we will have no info about contributors - name: Build run: | + set -xv # temporary, needed to debug git -C "$GITHUB_WORKSPACE" submodule sync --recursive git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 sudo rm -fr "$TEMP_PATH" @@ -159,1394 +173,30 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" "$CACHES_PATH" - BuilderDebAarch64: - needs: [DockerHubPush] - runs-on: [self-hosted, builder] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/build_check - IMAGES_PATH=${{runner.temp}}/images_path - REPO_COPY=${{runner.temp}}/build_check/ClickHouse - CACHES_PATH=${{runner.temp}}/../ccaches - CHECK_NAME=ClickHouse build check (actions) - BUILD_NAME=package_aarch64 - EOF - - name: Download changed images - uses: actions/download-artifact@v2 - with: - name: changed_images - path: ${{ runner.temp }}/images_path - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise we will have no info about contributors - - name: Build - run: | - git -C "$GITHUB_WORKSPACE" submodule sync --recursive - git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" && python3 build_check.py "$CHECK_NAME" "$BUILD_NAME" - - name: Upload build URLs to artifacts - uses: actions/upload-artifact@v2 - with: - name: ${{ env.BUILD_URLS }} - path: ${{ runner.temp }}/build_check/${{ env.BUILD_URLS }}.json - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" "$CACHES_PATH" - BuilderDebAsan: - needs: [DockerHubPush] - runs-on: [self-hosted, builder] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/build_check - IMAGES_PATH=${{runner.temp}}/images_path - REPO_COPY=${{runner.temp}}/build_check/ClickHouse - CACHES_PATH=${{runner.temp}}/../ccaches - CHECK_NAME=ClickHouse build check (actions) - BUILD_NAME=package_asan - EOF - - name: Download changed images - uses: actions/download-artifact@v2 - with: - name: changed_images - path: ${{ env.IMAGES_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise we will have no info about contributors - - name: Build - run: | - git -C "$GITHUB_WORKSPACE" submodule sync --recursive - git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" && python3 build_check.py "$CHECK_NAME" "$BUILD_NAME" - - name: Upload build URLs to artifacts - if: ${{ success() || failure() }} - uses: actions/upload-artifact@v2 - with: - name: ${{ env.BUILD_URLS }} - path: ${{ env.TEMP_PATH }}/${{ env.BUILD_URLS }}.json - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" "$CACHES_PATH" - BuilderDebUBsan: - needs: [DockerHubPush] - runs-on: [self-hosted, builder] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/build_check - IMAGES_PATH=${{runner.temp}}/images_path - REPO_COPY=${{runner.temp}}/build_check/ClickHouse - CACHES_PATH=${{runner.temp}}/../ccaches - CHECK_NAME=ClickHouse build check (actions) - BUILD_NAME=package_ubsan - EOF - - name: Download changed images - uses: actions/download-artifact@v2 - with: - name: changed_images - path: ${{ env.IMAGES_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise we will have no info about contributors - - name: Build - run: | - git -C "$GITHUB_WORKSPACE" submodule sync --recursive - git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" && python3 build_check.py "$CHECK_NAME" "$BUILD_NAME" - - name: Upload build URLs to artifacts - if: ${{ success() || failure() }} - uses: actions/upload-artifact@v2 - with: - name: ${{ env.BUILD_URLS }} - path: ${{ env.TEMP_PATH }}/${{ env.BUILD_URLS }}.json - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" "$CACHES_PATH" - BuilderDebTsan: - needs: [DockerHubPush] - runs-on: [self-hosted, builder] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/build_check - IMAGES_PATH=${{runner.temp}}/images_path - REPO_COPY=${{runner.temp}}/build_check/ClickHouse - CACHES_PATH=${{runner.temp}}/../ccaches - CHECK_NAME=ClickHouse build check (actions) - BUILD_NAME=package_tsan - EOF - - name: Download changed images - uses: actions/download-artifact@v2 - with: - name: changed_images - path: ${{ env.IMAGES_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise we will have no info about contributors - - name: Build - run: | - git -C "$GITHUB_WORKSPACE" submodule sync --recursive - git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" && python3 build_check.py "$CHECK_NAME" "$BUILD_NAME" - - name: Upload build URLs to artifacts - if: ${{ success() || failure() }} - uses: actions/upload-artifact@v2 - with: - name: ${{ env.BUILD_URLS }} - path: ${{ env.TEMP_PATH }}/${{ env.BUILD_URLS }}.json - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" "$CACHES_PATH" - BuilderDebMsan: - needs: [DockerHubPush] - runs-on: [self-hosted, builder] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/build_check - IMAGES_PATH=${{runner.temp}}/images_path - REPO_COPY=${{runner.temp}}/build_check/ClickHouse - CACHES_PATH=${{runner.temp}}/../ccaches - CHECK_NAME=ClickHouse build check (actions) - BUILD_NAME=package_msan - EOF - - name: Download changed images - uses: actions/download-artifact@v2 - with: - name: changed_images - path: ${{ env.IMAGES_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise we will have no info about contributors - - name: Build - run: | - git -C "$GITHUB_WORKSPACE" submodule sync --recursive - git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" && python3 build_check.py "$CHECK_NAME" "$BUILD_NAME" - - name: Upload build URLs to artifacts - if: ${{ success() || failure() }} - uses: actions/upload-artifact@v2 - with: - name: ${{ env.BUILD_URLS }} - path: ${{ env.TEMP_PATH }}/${{ env.BUILD_URLS }}.json - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" "$CACHES_PATH" - BuilderDebDebug: - needs: [DockerHubPush] - runs-on: [self-hosted, builder] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/build_check - IMAGES_PATH=${{runner.temp}}/images_path - REPO_COPY=${{runner.temp}}/build_check/ClickHouse - CACHES_PATH=${{runner.temp}}/../ccaches - CHECK_NAME=ClickHouse build check (actions) - BUILD_NAME=package_debug - EOF - - name: Download changed images - uses: actions/download-artifact@v2 - with: - name: changed_images - path: ${{ env.IMAGES_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # otherwise we will have no info about contributors - - name: Build - run: | - git -C "$GITHUB_WORKSPACE" submodule sync --recursive - git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" && python3 build_check.py "$CHECK_NAME" "$BUILD_NAME" - - name: Upload build URLs to artifacts - if: ${{ success() || failure() }} - uses: actions/upload-artifact@v2 - with: - name: ${{ env.BUILD_URLS }} - path: ${{ env.TEMP_PATH }}/${{ env.BUILD_URLS }}.json - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" "$CACHES_PATH" -############################################################################################ -##################################### Docker images ####################################### -############################################################################################ - DockerServerImages: - needs: - - BuilderDebRelease - - BuilderDebAarch64 - runs-on: [self-hosted, style-checker] - steps: - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # It MUST BE THE SAME for all dependencies and the job itself - - name: Check docker clickhouse/clickhouse-server building - run: | - cd "$GITHUB_WORKSPACE/tests/ci" - python3 docker_server.py --release-type head --no-push - python3 docker_server.py --release-type head --no-push --no-ubuntu \ - --image-repo clickhouse/clickhouse-keeper --image-path docker/keeper - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" -############################################################################################ -##################################### BUILD REPORTER ####################################### -############################################################################################ - BuilderReport: - needs: - - BuilderDebRelease - - BuilderDebAarch64 - - BuilderDebAsan - - BuilderDebTsan - - BuilderDebUBsan - - BuilderDebMsan - - BuilderDebDebug - runs-on: [self-hosted, style-checker] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - CHECK_NAME=ClickHouse build check (actions) - REPORTS_PATH=${{runner.temp}}/reports_dir - REPORTS_PATH=${{runner.temp}}/reports_dir - TEMP_PATH=${{runner.temp}}/report_check - NEEDS_DATA_PATH=${{runner.temp}}/needs.json - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Report Builder - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cat > "$NEEDS_DATA_PATH" << 'EOF' - ${{ toJSON(needs) }} - EOF - cd "$GITHUB_WORKSPACE/tests/ci" - python3 build_report_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" -############################################################################################## -########################### FUNCTIONAl STATELESS TESTS ####################################### -############################################################################################## - FunctionalStatelessTestRelease: - needs: [BuilderDebRelease] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (release, actions) - REPO_COPY=${{runner.temp}}/stateless_debug/ClickHouse - KILL_TIMEOUT=10800 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestAarch64: - needs: [BuilderDebAarch64] - runs-on: [self-hosted, func-tester-aarch64] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_release - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (aarch64, actions) - REPO_COPY=${{runner.temp}}/stateless_release/ClickHouse - KILL_TIMEOUT=10800 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestAsan0: - needs: [BuilderDebAsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (address, actions) - REPO_COPY=${{runner.temp}}/stateless_debug/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=0 - RUN_BY_HASH_TOTAL=2 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestAsan1: - needs: [BuilderDebAsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (address, actions) - REPO_COPY=${{runner.temp}}/stateless_debug/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=1 - RUN_BY_HASH_TOTAL=2 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestTsan0: - needs: [BuilderDebTsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_tsan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (thread, actions) - REPO_COPY=${{runner.temp}}/stateless_tsan/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=0 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestTsan1: - needs: [BuilderDebTsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_tsan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (thread, actions) - REPO_COPY=${{runner.temp}}/stateless_tsan/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=1 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestTsan2: - needs: [BuilderDebTsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_tsan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (thread, actions) - REPO_COPY=${{runner.temp}}/stateless_tsan/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=2 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestUBsan: - needs: [BuilderDebUBsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_ubsan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (ubsan, actions) - REPO_COPY=${{runner.temp}}/stateless_ubsan/ClickHouse - KILL_TIMEOUT=10800 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestMsan0: - needs: [BuilderDebMsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_memory - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (memory, actions) - REPO_COPY=${{runner.temp}}/stateless_memory/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=0 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestMsan1: - needs: [BuilderDebMsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_memory - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (memory, actions) - REPO_COPY=${{runner.temp}}/stateless_memory/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=1 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestMsan2: - needs: [BuilderDebMsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_memory - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (memory, actions) - REPO_COPY=${{runner.temp}}/stateless_memory/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=2 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestDebug0: - needs: [BuilderDebDebug] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (debug, actions) - REPO_COPY=${{runner.temp}}/stateless_debug/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=0 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestDebug1: - needs: [BuilderDebDebug] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (debug, actions) - REPO_COPY=${{runner.temp}}/stateless_debug/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=1 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatelessTestDebug2: - needs: [BuilderDebDebug] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateless_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateless tests (debug, actions) - REPO_COPY=${{runner.temp}}/stateless_debug/ClickHouse - KILL_TIMEOUT=10800 - RUN_BY_HASH_NUM=2 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" -############################################################################################## -############################ FUNCTIONAl STATEFUL TESTS ####################################### -############################################################################################## - FunctionalStatefulTestRelease: - needs: [BuilderDebRelease] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateful_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateful tests (release, actions) - REPO_COPY=${{runner.temp}}/stateful_debug/ClickHouse - KILL_TIMEOUT=3600 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatefulTestAarch64: - needs: [BuilderDebAarch64] - runs-on: [self-hosted, func-tester-aarch64] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateful_release - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateful tests (aarch64, actions) - REPO_COPY=${{runner.temp}}/stateful_release/ClickHouse - KILL_TIMEOUT=3600 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatefulTestAsan: - needs: [BuilderDebAsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateful_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateful tests (address, actions) - REPO_COPY=${{runner.temp}}/stateful_debug/ClickHouse - KILL_TIMEOUT=3600 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatefulTestTsan: - needs: [BuilderDebTsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateful_tsan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateful tests (thread, actions) - REPO_COPY=${{runner.temp}}/stateful_tsan/ClickHouse - KILL_TIMEOUT=3600 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatefulTestMsan: - needs: [BuilderDebMsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateful_msan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateful tests (memory, actions) - REPO_COPY=${{runner.temp}}/stateful_msan/ClickHouse - KILL_TIMEOUT=3600 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatefulTestUBsan: - needs: [BuilderDebUBsan] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateful_ubsan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateful tests (ubsan, actions) - REPO_COPY=${{runner.temp}}/stateful_ubsan/ClickHouse - KILL_TIMEOUT=3600 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - FunctionalStatefulTestDebug: - needs: [BuilderDebDebug] - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stateful_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stateful tests (debug, actions) - REPO_COPY=${{runner.temp}}/stateful_debug/ClickHouse - KILL_TIMEOUT=3600 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Functional test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" -############################################################################################## -######################################### STRESS TESTS ####################################### -############################################################################################## - StressTestAsan: - needs: [BuilderDebAsan] - runs-on: [self-hosted, stress-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stress_thread - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stress test (address, actions) - REPO_COPY=${{runner.temp}}/stress_thread/ClickHouse - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Stress test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 stress_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - StressTestTsan: - needs: [BuilderDebTsan] - # func testers have 16 cores + 128 GB memory - # while stress testers have 36 cores + 72 memory - # It would be better to have something like 32 + 128, - # but such servers almost unavailable as spot instances. - runs-on: [self-hosted, func-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stress_thread - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stress test (thread, actions) - REPO_COPY=${{runner.temp}}/stress_thread/ClickHouse - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Stress test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 stress_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - StressTestMsan: - needs: [BuilderDebMsan] - runs-on: [self-hosted, stress-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stress_memory - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stress test (memory, actions) - REPO_COPY=${{runner.temp}}/stress_memory/ClickHouse - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Stress test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 stress_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - StressTestUBsan: - needs: [BuilderDebUBsan] - runs-on: [self-hosted, stress-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stress_undefined - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stress test (undefined, actions) - REPO_COPY=${{runner.temp}}/stress_undefined/ClickHouse - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Stress test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 stress_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - StressTestDebug: - needs: [BuilderDebDebug] - runs-on: [self-hosted, stress-tester] + git -C "$GITHUB_WORKSPACE" submodule sync --recursive + git -C "$GITHUB_WORKSPACE" submodule update --depth=1 --recursive --init --jobs=10 + ############################################################################################ + ##################################### Docker images ####################################### + ############################################################################################ + DockerServerImages: + needs: + - BuilderDebRelease + # - BuilderDebAarch64 - currently we do not build aarch images + runs-on: [self-hosted, style-checker] steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/stress_debug - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Stress test (debug, actions) - REPO_COPY=${{runner.temp}}/stress_debug/ClickHouse - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - name: Clear repository run: | sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - name: Check out repository code uses: actions/checkout@v2 - - name: Stress test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 stress_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" -############################################################################################# -############################# INTEGRATION TESTS ############################################# -############################################################################################# - IntegrationTestsAsan0: - needs: [BuilderDebAsan] - runs-on: [self-hosted, stress-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_asan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (asan, actions) - REPO_COPY=${{runner.temp}}/integration_tests_asan/ClickHouse - RUN_BY_HASH_NUM=0 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Integration test + fetch-depth: 0 # It MUST BE THE SAME for all dependencies and the job itself + - name: Check docker clickhouse/clickhouse-server building run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 integration_test_check.py "$CHECK_NAME" + cd "$GITHUB_WORKSPACE/tests/ci" + python3 docker_server.py --release-type head --no-push + python3 docker_server.py --release-type head --no-push --no-ubuntu \ + --image-repo clickhouse/clickhouse-keeper --image-path docker/keeper - name: Cleanup if: always() run: | @@ -1555,57 +205,22 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" - IntegrationTestsAsan1: - needs: [BuilderDebAsan] - runs-on: [self-hosted, stress-tester] + ############################################################################################ + ##################################### BUILD REPORTER ####################################### + ############################################################################################ + BuilderReport: + needs: + - BuilderDebRelease + runs-on: [self-hosted, style-checker] steps: - name: Set envs run: | cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_asan + CHECK_NAME=ClickHouse build check (actions) REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (asan, actions) - REPO_COPY=${{runner.temp}}/integration_tests_asan/ClickHouse - RUN_BY_HASH_NUM=1 - RUN_BY_HASH_TOTAL=3 - EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Integration test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 integration_test_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - IntegrationTestsAsan2: - needs: [BuilderDebAsan] - runs-on: [self-hosted, stress-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_asan REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (asan, actions) - REPO_COPY=${{runner.temp}}/integration_tests_asan/ClickHouse - RUN_BY_HASH_NUM=2 - RUN_BY_HASH_TOTAL=3 + TEMP_PATH=${{runner.temp}}/report_check + NEEDS_DATA_PATH=${{runner.temp}}/needs.json EOF - name: Download json reports uses: actions/download-artifact@v2 @@ -1616,51 +231,15 @@ jobs: sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - name: Check out repository code uses: actions/checkout@v2 - - name: Integration test + - name: Report Builder run: | sudo rm -fr "$TEMP_PATH" mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 integration_test_check.py "$CHECK_NAME" - - name: Cleanup - if: always() - run: | - # shellcheck disable=SC2046 - docker kill $(docker ps -q) ||: - # shellcheck disable=SC2046 - docker rm -f $(docker ps -a -q) ||: - sudo rm -fr "$TEMP_PATH" - IntegrationTestsTsan0: - needs: [BuilderDebTsan] - runs-on: [self-hosted, stress-tester] - steps: - - name: Set envs - run: | - cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_tsan - REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (thread, actions) - REPO_COPY=${{runner.temp}}/integration_tests_tsan/ClickHouse - RUN_BY_HASH_NUM=0 - RUN_BY_HASH_TOTAL=4 + cat > "$NEEDS_DATA_PATH" << 'EOF' + ${{ toJSON(needs) }} EOF - - name: Download json reports - uses: actions/download-artifact@v2 - with: - path: ${{ env.REPORTS_PATH }} - - name: Clear repository - run: | - sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - - name: Check out repository code - uses: actions/checkout@v2 - - name: Integration test - run: | - sudo rm -fr "$TEMP_PATH" - mkdir -p "$TEMP_PATH" - cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" - cd "$REPO_COPY/tests/ci" - python3 integration_test_check.py "$CHECK_NAME" + cd "$GITHUB_WORKSPACE/tests/ci" + python3 build_report_check.py "$CHECK_NAME" - name: Cleanup if: always() run: | @@ -1669,19 +248,21 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" - IntegrationTestsTsan1: - needs: [BuilderDebTsan] - runs-on: [self-hosted, stress-tester] + ############################################################################################## + ########################### FUNCTIONAl STATELESS TESTS ####################################### + ############################################################################################## + FunctionalStatelessTestRelease: + needs: [BuilderDebRelease] + runs-on: [self-hosted, func-tester] steps: - name: Set envs run: | cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_tsan + TEMP_PATH=${{runner.temp}}/stateless_debug REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (thread, actions) - REPO_COPY=${{runner.temp}}/integration_tests_tsan/ClickHouse - RUN_BY_HASH_NUM=1 - RUN_BY_HASH_TOTAL=4 + CHECK_NAME=Stateless tests (release, actions) + REPO_COPY=${{runner.temp}}/stateless_debug/ClickHouse + KILL_TIMEOUT=10800 EOF - name: Download json reports uses: actions/download-artifact@v2 @@ -1692,13 +273,13 @@ jobs: sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - name: Check out repository code uses: actions/checkout@v2 - - name: Integration test + - name: Functional test run: | sudo rm -fr "$TEMP_PATH" mkdir -p "$TEMP_PATH" cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" cd "$REPO_COPY/tests/ci" - python3 integration_test_check.py "$CHECK_NAME" + python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - name: Cleanup if: always() run: | @@ -1707,19 +288,21 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" - IntegrationTestsTsan2: - needs: [BuilderDebTsan] - runs-on: [self-hosted, stress-tester] + ############################################################################################## + ############################ FUNCTIONAl STATEFUL TESTS ####################################### + ############################################################################################## + FunctionalStatefulTestRelease: + needs: [BuilderDebRelease] + runs-on: [self-hosted, func-tester] steps: - name: Set envs run: | cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_tsan + TEMP_PATH=${{runner.temp}}/stateful_debug REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (thread, actions) - REPO_COPY=${{runner.temp}}/integration_tests_tsan/ClickHouse - RUN_BY_HASH_NUM=2 - RUN_BY_HASH_TOTAL=4 + CHECK_NAME=Stateful tests (release, actions) + REPO_COPY=${{runner.temp}}/stateful_debug/ClickHouse + KILL_TIMEOUT=3600 EOF - name: Download json reports uses: actions/download-artifact@v2 @@ -1730,13 +313,13 @@ jobs: sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - name: Check out repository code uses: actions/checkout@v2 - - name: Integration test + - name: Functional test run: | sudo rm -fr "$TEMP_PATH" mkdir -p "$TEMP_PATH" cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" cd "$REPO_COPY/tests/ci" - python3 integration_test_check.py "$CHECK_NAME" + python3 functional_test_check.py "$CHECK_NAME" "$KILL_TIMEOUT" - name: Cleanup if: always() run: | @@ -1745,19 +328,22 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" - IntegrationTestsTsan3: - needs: [BuilderDebTsan] + ############################################################################################# + ############################# INTEGRATION TESTS ############################################# + ############################################################################################# + IntegrationTestsRelease0: + needs: [BuilderDebRelease] runs-on: [self-hosted, stress-tester] steps: - name: Set envs run: | cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_tsan + TEMP_PATH=${{runner.temp}}/integration_tests_release REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (thread, actions) - REPO_COPY=${{runner.temp}}/integration_tests_tsan/ClickHouse - RUN_BY_HASH_NUM=3 - RUN_BY_HASH_TOTAL=4 + CHECK_NAME=Integration tests (release, actions) + REPO_COPY=${{runner.temp}}/integration_tests_release/ClickHouse + RUN_BY_HASH_NUM=0 + RUN_BY_HASH_TOTAL=2 EOF - name: Download json reports uses: actions/download-artifact@v2 @@ -1783,7 +369,7 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" - IntegrationTestsRelease0: + IntegrationTestsRelease1: needs: [BuilderDebRelease] runs-on: [self-hosted, stress-tester] steps: @@ -1794,7 +380,7 @@ jobs: REPORTS_PATH=${{runner.temp}}/reports_dir CHECK_NAME=Integration tests (release, actions) REPO_COPY=${{runner.temp}}/integration_tests_release/ClickHouse - RUN_BY_HASH_NUM=0 + RUN_BY_HASH_NUM=1 RUN_BY_HASH_TOTAL=2 EOF - name: Download json reports @@ -1821,19 +407,20 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" - IntegrationTestsRelease1: + ############################################################################################# + ############################### TESTFLOWS TESTS ############################################# + ############################################################################################# + TestFlowsTestsRelease: needs: [BuilderDebRelease] runs-on: [self-hosted, stress-tester] steps: - name: Set envs run: | cat >> "$GITHUB_ENV" << 'EOF' - TEMP_PATH=${{runner.temp}}/integration_tests_release + TEMP_PATH=${{runner.temp}}/testflows_tests_release REPORTS_PATH=${{runner.temp}}/reports_dir - CHECK_NAME=Integration tests (release, actions) - REPO_COPY=${{runner.temp}}/integration_tests_release/ClickHouse - RUN_BY_HASH_NUM=1 - RUN_BY_HASH_TOTAL=2 + CHECK_NAME=TestFlows tests (release, actions) + REPO_COPY=${{runner.temp}}/testflows_tests_release/ClickHouse EOF - name: Download json reports uses: actions/download-artifact@v2 @@ -1844,13 +431,13 @@ jobs: sudo rm -fr "$GITHUB_WORKSPACE" && mkdir "$GITHUB_WORKSPACE" - name: Check out repository code uses: actions/checkout@v2 - - name: Integration test + - name: TestFlows test run: | sudo rm -fr "$TEMP_PATH" mkdir -p "$TEMP_PATH" cp -r "$GITHUB_WORKSPACE" "$TEMP_PATH" cd "$REPO_COPY/tests/ci" - python3 integration_test_check.py "$CHECK_NAME" + python3 testflows_test_check.py "$CHECK_NAME" - name: Cleanup if: always() run: | @@ -1859,46 +446,19 @@ jobs: # shellcheck disable=SC2046 docker rm -f $(docker ps -a -q) ||: sudo rm -fr "$TEMP_PATH" + ########################################################################################### + ################################ FINISH CHECK ############################################# + ########################################################################################### FinishCheck: needs: - DockerHubPush - DockerServerImages - BuilderReport - - FunctionalStatelessTestDebug0 - - FunctionalStatelessTestDebug1 - - FunctionalStatelessTestDebug2 - FunctionalStatelessTestRelease - - FunctionalStatelessTestAarch64 - - FunctionalStatelessTestAsan0 - - FunctionalStatelessTestAsan1 - - FunctionalStatelessTestTsan0 - - FunctionalStatelessTestTsan1 - - FunctionalStatelessTestTsan2 - - FunctionalStatelessTestMsan0 - - FunctionalStatelessTestMsan1 - - FunctionalStatelessTestMsan2 - - FunctionalStatelessTestUBsan - - FunctionalStatefulTestDebug - FunctionalStatefulTestRelease - - FunctionalStatefulTestAarch64 - - FunctionalStatefulTestAsan - - FunctionalStatefulTestTsan - - FunctionalStatefulTestMsan - - FunctionalStatefulTestUBsan - - StressTestDebug - - StressTestAsan - - StressTestTsan - - StressTestMsan - - StressTestUBsan - - IntegrationTestsAsan0 - - IntegrationTestsAsan1 - - IntegrationTestsAsan2 - IntegrationTestsRelease0 - IntegrationTestsRelease1 - - IntegrationTestsTsan0 - - IntegrationTestsTsan1 - - IntegrationTestsTsan2 - - IntegrationTestsTsan3 + - TestFlowsTestsRelease - CompatibilityCheck runs-on: [self-hosted, style-checker] steps: diff --git a/cmake/autogenerated_versions.txt b/cmake/autogenerated_versions.txt index ec0e9a8411f..c456e56afe9 100644 --- a/cmake/autogenerated_versions.txt +++ b/cmake/autogenerated_versions.txt @@ -7,6 +7,8 @@ SET(VERSION_MAJOR 22) SET(VERSION_MINOR 3) SET(VERSION_PATCH 12) SET(VERSION_GITHASH 137c5f726570170c81c89e7dda153936d49012b9) -SET(VERSION_DESCRIBE v22.3.12.1-lts) -SET(VERSION_STRING 22.3.12.1) +SET(VERSION_TWEAK 2) +SET(VERSION_FLAVOUR altinitystable) +SET(VERSION_DESCRIBE v22.3.12.2-altinitystable) +SET(VERSION_STRING 22.3.12.2.altinitystable) # end of autochange diff --git a/cmake/version.cmake b/cmake/version.cmake index acaa772ff2f..d785da5fe9b 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -19,5 +19,5 @@ set (VERSION_STRING_SHORT "${VERSION_MAJOR}.${VERSION_MINOR}") math (EXPR VERSION_INTEGER "${VERSION_PATCH} + ${VERSION_MINOR}*1000 + ${VERSION_MAJOR}*1000000") if(CLICKHOUSE_OFFICIAL_BUILD) - set(VERSION_OFFICIAL " (official build)") + set(VERSION_OFFICIAL " (altinity build)") endif() diff --git a/docker/images.json b/docker/images.json index 06d689e8f7c..baf88e9e610 100644 --- a/docker/images.json +++ b/docker/images.json @@ -1,164 +1,149 @@ { "docker/packager/deb": { - "name": "clickhouse/deb-builder", + "name": "altinityinfra/deb-builder", "dependent": [] }, "docker/packager/binary": { - "name": "clickhouse/binary-builder", + "name": "altinityinfra/binary-builder", "dependent": [ "docker/test/split_build_smoke_test", "docker/test/codebrowser" ] }, "docker/test/compatibility/centos": { - "name": "clickhouse/test-old-centos", + "name": "altinityinfra/test-old-centos", "dependent": [] }, "docker/test/compatibility/ubuntu": { - "name": "clickhouse/test-old-ubuntu", + "name": "altinityinfra/test-old-ubuntu", "dependent": [] }, "docker/test/integration/base": { - "name": "clickhouse/integration-test", + "name": "altinityinfra/integration-test", "dependent": [] }, "docker/test/fuzzer": { - "name": "clickhouse/fuzzer", + "name": "altinityinfra/fuzzer", "dependent": [] }, "docker/test/performance-comparison": { - "name": "clickhouse/performance-comparison", + "name": "altinityinfra/performance-comparison", "dependent": [] }, "docker/test/util": { - "name": "clickhouse/test-util", + "name": "altinityinfra/test-util", "dependent": [ "docker/test/base", "docker/test/fasttest" ] }, "docker/test/stateless": { - "name": "clickhouse/stateless-test", + "name": "altinityinfra/stateless-test", "dependent": [ "docker/test/stateful", "docker/test/unit" ] }, "docker/test/stateful": { - "name": "clickhouse/stateful-test", + "name": "altinityinfra/stateful-test", "dependent": [ "docker/test/stress" ] }, "docker/test/unit": { - "name": "clickhouse/unit-test", + "name": "altinityinfra/unit-test", "dependent": [] }, "docker/test/stress": { - "name": "clickhouse/stress-test", + "name": "altinityinfra/stress-test", "dependent": [] }, "docker/test/split_build_smoke_test": { - "name": "clickhouse/split-build-smoke-test", + "name": "altinityinfra/split-build-smoke-test", "dependent": [] }, "docker/test/codebrowser": { - "name": "clickhouse/codebrowser", + "name": "altinityinfra/codebrowser", "dependent": [] }, "docker/test/integration/runner": { "only_amd64": true, - "name": "clickhouse/integration-tests-runner", + "name": "altinityinfra/integration-tests-runner", "dependent": [] }, "docker/test/testflows/runner": { - "name": "clickhouse/testflows-runner", + "name": "altinityinfra/testflows-runner", "dependent": [] }, "docker/test/fasttest": { - "name": "clickhouse/fasttest", + "name": "altinityinfra/fasttest", "dependent": [] }, "docker/test/style": { - "name": "clickhouse/style-test", + "name": "altinityinfra/style-test", "dependent": [] }, "docker/test/integration/s3_proxy": { - "name": "clickhouse/s3-proxy", + "name": "altinityinfra/s3-proxy", "dependent": [] }, "docker/test/integration/resolver": { - "name": "clickhouse/python-bottle", + "name": "altinityinfra/python-bottle", "dependent": [] }, "docker/test/integration/helper_container": { - "name": "clickhouse/integration-helper", + "name": "altinityinfra/integration-helper", "dependent": [] }, "docker/test/integration/mysql_golang_client": { - "name": "clickhouse/mysql-golang-client", + "name": "altinityinfra/mysql-golang-client", "dependent": [] }, "docker/test/integration/dotnet_client": { - "name": "clickhouse/dotnet-client", + "name": "altinityinfra/dotnet-client", "dependent": [] }, "docker/test/integration/mysql_java_client": { - "name": "clickhouse/mysql-java-client", + "name": "altinityinfra/mysql-java-client", "dependent": [] }, "docker/test/integration/mysql_js_client": { - "name": "clickhouse/mysql-js-client", + "name": "altinityinfra/mysql-js-client", "dependent": [] }, "docker/test/integration/mysql_php_client": { - "name": "clickhouse/mysql-php-client", + "name": "altinityinfra/mysql-php-client", "dependent": [] }, "docker/test/integration/postgresql_java_client": { - "name": "clickhouse/postgresql-java-client", + "name": "altinityinfra/postgresql-java-client", "dependent": [] }, "docker/test/integration/kerberos_kdc": { "only_amd64": true, - "name": "clickhouse/kerberos-kdc", + "name": "altinityinfra/kerberos-kdc", "dependent": [] }, "docker/test/base": { - "name": "clickhouse/test-base", - "dependent": [ + "name": "altinityinfra/test-base", + "dependent": [ "docker/test/stateless", "docker/test/integration/base", "docker/test/fuzzer", "docker/test/keeper-jepsen" - ] + ] }, "docker/test/integration/kerberized_hadoop": { "only_amd64": true, - "name": "clickhouse/kerberized-hadoop", + "name": "altinityinfra/kerberized-hadoop", "dependent": [] }, "docker/test/sqlancer": { - "name": "clickhouse/sqlancer-test", + "name": "altinityinfra/sqlancer-test", "dependent": [] }, "docker/test/keeper-jepsen": { - "name": "clickhouse/keeper-jepsen-test", - "dependent": [] - }, - "docker/docs/builder": { - "name": "clickhouse/docs-builder", - "dependent": [ - "docker/docs/check", - "docker/docs/release" - ] - }, - "docker/docs/check": { - "name": "clickhouse/docs-check", - "dependent": [] - }, - "docker/docs/release": { - "name": "clickhouse/docs-release", + "name": "altinityinfra/keeper-jepsen-test", "dependent": [] } } diff --git a/docker/packager/binary/build.sh b/docker/packager/binary/build.sh index 943b92abdda..7ed58b3d82a 100755 --- a/docker/packager/binary/build.sh +++ b/docker/packager/binary/build.sh @@ -19,6 +19,9 @@ ln -sf darwin-x86_64 build/cmake/toolchain/darwin-aarch64 # export CCACHE_LOGFILE=/build/ccache.log # export CCACHE_DEBUG=1 +# https://stackoverflow.com/a/71940133 +git config --global --add safe.directory '*' + mkdir -p build/build_docker cd build/build_docker rm -f CMakeCache.txt diff --git a/docker/packager/packager b/docker/packager/packager index f82d402d613..6235ee7ad10 100755 --- a/docker/packager/packager +++ b/docker/packager/packager @@ -331,7 +331,7 @@ if __name__ == "__main__": args.output_dir = os.path.abspath(os.path.join(os.getcwd(), args.output_dir)) image_type = "binary" if args.package_type == "performance" else args.package_type - image_name = "clickhouse/binary-builder" + image_name = "altinityinfra/binary-builder" if not os.path.isabs(args.clickhouse_repo_path): ch_root = os.path.abspath(os.path.join(os.getcwd(), args.clickhouse_repo_path)) diff --git a/docker/test/base/Dockerfile b/docker/test/base/Dockerfile index 6beab2e5bb7..58fa01241e1 100644 --- a/docker/test/base/Dockerfile +++ b/docker/test/base/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 -# docker build -t clickhouse/test-base . +# docker build -t altinityinfra/test-base . ARG FROM_TAG=latest -FROM clickhouse/test-util:$FROM_TAG +FROM altinityinfra/test-util:$FROM_TAG # ARG for quick switch to a given ubuntu mirror ARG apt_archive="http://archive.ubuntu.com" diff --git a/docker/test/codebrowser/Dockerfile b/docker/test/codebrowser/Dockerfile index 97f3f54ad98..86147635373 100644 --- a/docker/test/codebrowser/Dockerfile +++ b/docker/test/codebrowser/Dockerfile @@ -2,7 +2,7 @@ # docker build --network=host -t clickhouse/codebrowser . # docker run --volume=path_to_repo:/repo_folder --volume=path_to_result:/test_output clickhouse/codebrowser ARG FROM_TAG=latest -FROM clickhouse/binary-builder:$FROM_TAG +FROM altinityinfra/binary-builder:$FROM_TAG # ARG for quick switch to a given ubuntu mirror ARG apt_archive="http://archive.ubuntu.com" diff --git a/docker/test/fasttest/Dockerfile b/docker/test/fasttest/Dockerfile index 46b74d89e13..f61b0d11057 100644 --- a/docker/test/fasttest/Dockerfile +++ b/docker/test/fasttest/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/fasttest . ARG FROM_TAG=latest -FROM clickhouse/test-util:$FROM_TAG +FROM altinityinfra/test-util:$FROM_TAG # ARG for quick switch to a given ubuntu mirror ARG apt_archive="http://archive.ubuntu.com" diff --git a/docker/test/fuzzer/Dockerfile b/docker/test/fuzzer/Dockerfile index eb4b09c173f..2aec54bd171 100644 --- a/docker/test/fuzzer/Dockerfile +++ b/docker/test/fuzzer/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/fuzzer . ARG FROM_TAG=latest -FROM clickhouse/test-base:$FROM_TAG +FROM altinityinfra/test-base:$FROM_TAG # ARG for quick switch to a given ubuntu mirror ARG apt_archive="http://archive.ubuntu.com" diff --git a/docker/test/integration/base/Dockerfile b/docker/test/integration/base/Dockerfile index 9b6318a5426..ff5c4b2982b 100644 --- a/docker/test/integration/base/Dockerfile +++ b/docker/test/integration/base/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/integration-test . ARG FROM_TAG=latest -FROM clickhouse/test-base:$FROM_TAG +FROM altinityinfra/test-base:$FROM_TAG SHELL ["/bin/bash", "-c"] diff --git a/docker/test/integration/mysql_php_client/Dockerfile b/docker/test/integration/mysql_php_client/Dockerfile index 0fb77bf8ffb..55db4d15a7f 100644 --- a/docker/test/integration/mysql_php_client/Dockerfile +++ b/docker/test/integration/mysql_php_client/Dockerfile @@ -1,7 +1,7 @@ # docker build -t clickhouse/mysql-php-client . # MySQL PHP client docker container -FROM php:7.3-cli +FROM php:8.0.18-cli COPY ./client.crt client.crt COPY ./client.key client.key diff --git a/docker/test/integration/runner/compose/docker_compose_dotnet_client.yml b/docker/test/integration/runner/compose/docker_compose_dotnet_client.yml index b63dac51522..e5746fa209f 100644 --- a/docker/test/integration/runner/compose/docker_compose_dotnet_client.yml +++ b/docker/test/integration/runner/compose/docker_compose_dotnet_client.yml @@ -1,6 +1,6 @@ version: '2.3' services: dotnet1: - image: clickhouse/dotnet-client:${DOCKER_DOTNET_CLIENT_TAG:-latest} + image: altinityinfra/dotnet-client:${DOCKER_DOTNET_CLIENT_TAG:-latest} # to keep container running command: sleep infinity diff --git a/docker/test/integration/runner/compose/docker_compose_keeper.yml b/docker/test/integration/runner/compose/docker_compose_keeper.yml index 134ffbff1f7..375003d5e14 100644 --- a/docker/test/integration/runner/compose/docker_compose_keeper.yml +++ b/docker/test/integration/runner/compose/docker_compose_keeper.yml @@ -1,7 +1,7 @@ version: '2.3' services: zoo1: - image: ${image:-clickhouse/integration-test} + image: ${image:-altinityinfra/integration-test} restart: always user: ${user:-} volumes: @@ -31,7 +31,7 @@ services: - inet6 - rotate zoo2: - image: ${image:-clickhouse/integration-test} + image: ${image:-altinityinfra/integration-test} restart: always user: ${user:-} volumes: @@ -61,7 +61,7 @@ services: - inet6 - rotate zoo3: - image: ${image:-clickhouse/integration-test} + image: ${image:-altinityinfra/integration-test} restart: always user: ${user:-} volumes: diff --git a/docker/test/integration/runner/compose/docker_compose_kerberized_hdfs.yml b/docker/test/integration/runner/compose/docker_compose_kerberized_hdfs.yml index e1b4d393169..365821b3f5e 100644 --- a/docker/test/integration/runner/compose/docker_compose_kerberized_hdfs.yml +++ b/docker/test/integration/runner/compose/docker_compose_kerberized_hdfs.yml @@ -4,7 +4,7 @@ services: kerberizedhdfs1: cap_add: - DAC_READ_SEARCH - image: clickhouse/kerberized-hadoop:${DOCKER_KERBERIZED_HADOOP_TAG:-latest} + image: altinityinfra/kerberized-hadoop:${DOCKER_KERBERIZED_HADOOP_TAG:-latest} hostname: kerberizedhdfs1 restart: always volumes: @@ -22,7 +22,7 @@ services: entrypoint: /etc/bootstrap.sh -d hdfskerberos: - image: clickhouse/kerberos-kdc:${DOCKER_KERBEROS_KDC_TAG:-latest} + image: altinityinfra/kerberos-kdc:${DOCKER_KERBEROS_KDC_TAG:-latest} hostname: hdfskerberos volumes: - ${KERBERIZED_HDFS_DIR}/secrets:/tmp/keytab diff --git a/docker/test/integration/runner/compose/docker_compose_kerberized_kafka.yml b/docker/test/integration/runner/compose/docker_compose_kerberized_kafka.yml index d57e4e4d5be..8dbdd9c74c0 100644 --- a/docker/test/integration/runner/compose/docker_compose_kerberized_kafka.yml +++ b/docker/test/integration/runner/compose/docker_compose_kerberized_kafka.yml @@ -50,7 +50,7 @@ services: - label:disable kafka_kerberos: - image: clickhouse/kerberos-kdc:${DOCKER_KERBEROS_KDC_TAG:-latest} + image: altinityinfra/kerberos-kdc:${DOCKER_KERBEROS_KDC_TAG:-latest} hostname: kafka_kerberos volumes: - ${KERBERIZED_KAFKA_DIR}/secrets:/tmp/keytab diff --git a/docker/test/integration/runner/compose/docker_compose_minio.yml b/docker/test/integration/runner/compose/docker_compose_minio.yml index 6e8c826b234..438f3486e17 100644 --- a/docker/test/integration/runner/compose/docker_compose_minio.yml +++ b/docker/test/integration/runner/compose/docker_compose_minio.yml @@ -21,14 +21,14 @@ services: # HTTP proxies for Minio. proxy1: - image: clickhouse/s3-proxy + image: altinityinfra/s3-proxy expose: - "8080" # Redirect proxy port - "80" # Reverse proxy port - "443" # Reverse proxy port (secure) proxy2: - image: clickhouse/s3-proxy + image: altinityinfra/s3-proxy expose: - "8080" - "80" @@ -36,7 +36,7 @@ services: # Empty container to run proxy resolver. resolver: - image: clickhouse/python-bottle + image: altinityinfra/python-bottle expose: - "8080" tty: true diff --git a/docker/test/integration/runner/compose/docker_compose_mysql_golang_client.yml b/docker/test/integration/runner/compose/docker_compose_mysql_golang_client.yml index 56cc0410574..09154b58424 100644 --- a/docker/test/integration/runner/compose/docker_compose_mysql_golang_client.yml +++ b/docker/test/integration/runner/compose/docker_compose_mysql_golang_client.yml @@ -1,6 +1,6 @@ version: '2.3' services: golang1: - image: clickhouse/mysql-golang-client:${DOCKER_MYSQL_GOLANG_CLIENT_TAG:-latest} + image: altinityinfra/mysql-golang-client:${DOCKER_MYSQL_GOLANG_CLIENT_TAG:-latest} # to keep container running command: sleep infinity diff --git a/docker/test/integration/runner/compose/docker_compose_mysql_java_client.yml b/docker/test/integration/runner/compose/docker_compose_mysql_java_client.yml index eb5ffb01baa..a84cef915df 100644 --- a/docker/test/integration/runner/compose/docker_compose_mysql_java_client.yml +++ b/docker/test/integration/runner/compose/docker_compose_mysql_java_client.yml @@ -1,6 +1,6 @@ version: '2.3' services: java1: - image: clickhouse/mysql-java-client:${DOCKER_MYSQL_JAVA_CLIENT_TAG:-latest} + image: altinityinfra/mysql-java-client:${DOCKER_MYSQL_JAVA_CLIENT_TAG:-latest} # to keep container running command: sleep infinity diff --git a/docker/test/integration/runner/compose/docker_compose_mysql_js_client.yml b/docker/test/integration/runner/compose/docker_compose_mysql_js_client.yml index 90939449c5f..b46eb2706c4 100644 --- a/docker/test/integration/runner/compose/docker_compose_mysql_js_client.yml +++ b/docker/test/integration/runner/compose/docker_compose_mysql_js_client.yml @@ -1,6 +1,6 @@ version: '2.3' services: mysqljs1: - image: clickhouse/mysql-js-client:${DOCKER_MYSQL_JS_CLIENT_TAG:-latest} + image: altinityinfra/mysql-js-client:${DOCKER_MYSQL_JS_CLIENT_TAG:-latest} # to keep container running command: sleep infinity diff --git a/docker/test/integration/runner/compose/docker_compose_mysql_php_client.yml b/docker/test/integration/runner/compose/docker_compose_mysql_php_client.yml index 408b8ff089a..662783a00a1 100644 --- a/docker/test/integration/runner/compose/docker_compose_mysql_php_client.yml +++ b/docker/test/integration/runner/compose/docker_compose_mysql_php_client.yml @@ -1,6 +1,6 @@ version: '2.3' services: php1: - image: clickhouse/mysql-php-client:${DOCKER_MYSQL_PHP_CLIENT_TAG:-latest} + image: altinityinfra/mysql-php-client:${DOCKER_MYSQL_PHP_CLIENT_TAG:-latest} # to keep container running command: sleep infinity diff --git a/docker/test/integration/runner/compose/docker_compose_postgresql_java_client.yml b/docker/test/integration/runner/compose/docker_compose_postgresql_java_client.yml index 904bfffdfd5..5c8673ae3ee 100644 --- a/docker/test/integration/runner/compose/docker_compose_postgresql_java_client.yml +++ b/docker/test/integration/runner/compose/docker_compose_postgresql_java_client.yml @@ -1,6 +1,6 @@ version: '2.2' services: java: - image: clickhouse/postgresql-java-client:${DOCKER_POSTGRESQL_JAVA_CLIENT_TAG:-latest} + image: altinityinfra/postgresql-java-client:${DOCKER_POSTGRESQL_JAVA_CLIENT_TAG:-latest} # to keep container running command: sleep infinity diff --git a/docker/test/keeper-jepsen/Dockerfile b/docker/test/keeper-jepsen/Dockerfile index a794e076ec0..b93b0718901 100644 --- a/docker/test/keeper-jepsen/Dockerfile +++ b/docker/test/keeper-jepsen/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/keeper-jepsen-test . ARG FROM_TAG=latest -FROM clickhouse/test-base:$FROM_TAG +FROM altinityinfra/test-base:$FROM_TAG ENV DEBIAN_FRONTEND=noninteractive ENV CLOJURE_VERSION=1.10.3.814 diff --git a/docker/test/split_build_smoke_test/Dockerfile b/docker/test/split_build_smoke_test/Dockerfile index 5f84eb42216..cb41859fb11 100644 --- a/docker/test/split_build_smoke_test/Dockerfile +++ b/docker/test/split_build_smoke_test/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 -# docker build -t clickhouse/split-build-smoke-test . +# docker build -t altinityinfra/split-build-smoke-test . ARG FROM_TAG=latest -FROM clickhouse/binary-builder:$FROM_TAG +FROM altinityinfra/binary-builder:$FROM_TAG COPY run.sh /run.sh COPY process_split_build_smoke_test_result.py / diff --git a/docker/test/stateful/Dockerfile b/docker/test/stateful/Dockerfile index 543cf113b2b..a68168b1271 100644 --- a/docker/test/stateful/Dockerfile +++ b/docker/test/stateful/Dockerfile @@ -1,13 +1,16 @@ # rebuild in #33610 # docker build -t clickhouse/stateful-test . ARG FROM_TAG=latest -FROM clickhouse/stateless-test:$FROM_TAG +# TODO consider replacing clickhouse with altinityinfra dockerhub account +FROM altinityinfra/stateless-test:$FROM_TAG RUN apt-get update -y \ && env DEBIAN_FRONTEND=noninteractive \ apt-get install --yes --no-install-recommends \ python3-requests \ - llvm-9 + llvm-9 \ + rpm2cpio \ + cpio COPY s3downloader /s3downloader @@ -17,8 +20,7 @@ ENV EXPORT_S3_STORAGE_POLICIES=1 # Download Minio-related binaries RUN arch=${TARGETARCH:-amd64} \ - && wget "https://dl.min.io/server/minio/release/linux-${arch}/minio" \ - && chmod +x ./minio \ + && wget "https://dl.min.io/server/minio/release/linux-${arch}/archive/minio-20220103182258.0.0.x86_64.rpm" \ && wget "https://dl.min.io/client/mc/release/linux-${arch}/mc" \ && chmod +x ./mc ENV MINIO_ROOT_USER="clickhouse" diff --git a/docker/test/stateful/setup_minio.sh b/docker/test/stateful/setup_minio.sh index 5758d905197..d077dea920c 100755 --- a/docker/test/stateful/setup_minio.sh +++ b/docker/test/stateful/setup_minio.sh @@ -9,6 +9,10 @@ set -e -x -a -u +rpm2cpio ./minio-20220103182258.0.0.x86_64.rpm | cpio -i --make-directories +find -name minio +cp ./usr/local/bin/minio ./ + ls -lha mkdir -p ./minio_data @@ -27,12 +31,19 @@ fi MINIO_ROOT_USER=${MINIO_ROOT_USER:-clickhouse} MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-clickhouse} +./minio --version ./minio server --address ":11111" ./minio_data & +i=0 while ! curl -v --silent http://localhost:11111 2>&1 | grep AccessDenied do + if [[ $i == 60 ]]; then + echo "Failed to setup minio" + exit 0 + fi echo "Trying to connect to minio" sleep 1 + i=$((i + 1)) done lsof -i :11111 diff --git a/docker/test/stateless/Dockerfile b/docker/test/stateless/Dockerfile index 68c08c23b3f..975a1da8d36 100644 --- a/docker/test/stateless/Dockerfile +++ b/docker/test/stateless/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/stateless-test . ARG FROM_TAG=latest -FROM clickhouse/test-base:$FROM_TAG +FROM altinityinfra/test-base:$FROM_TAG ARG odbc_driver_url="https://github.com/ClickHouse/clickhouse-odbc/releases/download/v1.1.4.20200302/clickhouse-odbc-1.1.4-Linux.tar.gz" @@ -32,7 +32,9 @@ RUN apt-get update -y \ mysql-client=8.0* \ postgresql-client \ sqlite3 \ - awscli + awscli \ + rpm2cpio \ + cpio RUN pip3 install numpy scipy pandas Jinja2 @@ -53,8 +55,7 @@ ARG TARGETARCH # Download Minio-related binaries RUN arch=${TARGETARCH:-amd64} \ - && wget "https://dl.min.io/server/minio/release/linux-${arch}/minio" \ - && chmod +x ./minio \ + && wget "https://dl.min.io/server/minio/release/linux-${arch}/archive/minio-20220103182258.0.0.x86_64.rpm" \ && wget "https://dl.min.io/client/mc/release/linux-${arch}/mc" \ && chmod +x ./mc diff --git a/docker/test/stateless/setup_minio.sh b/docker/test/stateless/setup_minio.sh index df27b21b05b..031a54639e9 100755 --- a/docker/test/stateless/setup_minio.sh +++ b/docker/test/stateless/setup_minio.sh @@ -16,21 +16,32 @@ if [ ! -f ./minio ]; then BINARY_TYPE=$(uname -s | tr '[:upper:]' '[:lower:]') - wget "https://dl.min.io/server/minio/release/${BINARY_TYPE}-amd64/minio" \ - && chmod +x ./minio \ + wget "https://dl.min.io/server/minio/release/${BINARY_TYPE}-amd64/archive/minio-20220103182258.0.0.x86_64.rpm" \ && wget "https://dl.min.io/client/mc/release/${BINARY_TYPE}-amd64/mc" \ && chmod +x ./mc fi +rpm2cpio ./minio-20220103182258.0.0.x86_64.rpm | cpio -i --make-directories +find -name minio +cp ./usr/local/bin/minio ./ + MINIO_ROOT_USER=${MINIO_ROOT_USER:-clickhouse} MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD:-clickhouse} +./minio --version + ./minio server --address ":11111" ./minio_data & +i=0 while ! curl -v --silent http://localhost:11111 2>&1 | grep AccessDenied do + if [[ $i == 60 ]]; then + echo "Failed to setup minio" + exit 0 + fi echo "Trying to connect to minio" sleep 1 + i=$((i + 1)) done lsof -i :11111 diff --git a/docker/test/stateless_pytest/Dockerfile b/docker/test/stateless_pytest/Dockerfile index 789ee0e9b30..c148b621241 100644 --- a/docker/test/stateless_pytest/Dockerfile +++ b/docker/test/stateless_pytest/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/stateless-pytest . ARG FROM_TAG=latest -FROM clickhouse/test-base:$FROM_TAG +FROM altinityinfra/test-base:$FROM_TAG RUN apt-get update -y && \ apt-get install -y --no-install-recommends \ diff --git a/docker/test/stress/Dockerfile b/docker/test/stress/Dockerfile index 393508fd551..4f6834fff73 100644 --- a/docker/test/stress/Dockerfile +++ b/docker/test/stress/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/stress-test . ARG FROM_TAG=latest -FROM clickhouse/stateful-test:$FROM_TAG +FROM altinityinfra/stateful-test:$FROM_TAG RUN apt-get update -y \ && env DEBIAN_FRONTEND=noninteractive \ diff --git a/docker/test/testflows/runner/Dockerfile b/docker/test/testflows/runner/Dockerfile index bfc3ed5e39f..d87ac0b5f32 100644 --- a/docker/test/testflows/runner/Dockerfile +++ b/docker/test/testflows/runner/Dockerfile @@ -38,7 +38,7 @@ RUN apt-get update \ ENV TZ=Europe/Moscow RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN pip3 install urllib3 testflows==1.7.20 docker-compose==1.29.2 docker==5.0.0 dicttoxml kazoo tzlocal==2.1 pytz python-dateutil numpy +RUN pip3 install urllib3 testflows==1.9.15 docker-compose==1.29.2 docker==5.0.0 dicttoxml kazoo tzlocal==2.1 pytz python-dateutil numpy ENV DOCKER_CHANNEL stable ENV DOCKER_VERSION 20.10.6 @@ -76,7 +76,16 @@ RUN set -x \ && echo 'dockremap:165536:65536' >> /etc/subuid \ && echo 'dockremap:165536:65536' >> /etc/subgid +RUN pip3 install pytz==2020.1 \ + python-dateutil==2.8.1 \ + minio==7.1.3 \ + boto3==1.24.52 \ + numpy==1.21.4 \ + pyarrow==7.0.0 \ + pandas==1.4.1 \ + awscli==1.24.9 + VOLUME /var/lib/docker EXPOSE 2375 ENTRYPOINT ["dockerd-entrypoint.sh"] -CMD ["sh", "-c", "python3 regression.py --no-color -o new-fails --local --clickhouse-binary-path ${CLICKHOUSE_TESTS_SERVER_BIN_PATH} --log test.log ${TESTFLOWS_OPTS}; cat test.log | tfs report results --format json > results.json; /usr/local/bin/process_testflows_result.py || echo -e 'failure\tCannot parse results' > check_status.tsv; find * -type f | grep _instances | grep clickhouse-server | xargs -n1 tar -rvf clickhouse_logs.tar; gzip -9 clickhouse_logs.tar"] +CMD ["sh", "-c", "python3 regression.py --test-to-end --no-color -o classic --local --clickhouse-binary-path ${CLICKHOUSE_TESTS_SERVER_BIN_PATH} --log test.log ${TESTFLOWS_OPTS}; cat test.log | tfs report results --format json > results.json; /usr/local/bin/process_testflows_result.py || echo -e 'failure\tCannot parse results' > check_status.tsv; find * -type f | grep _instances | grep clickhouse-server | xargs -n1 tar -rvf clickhouse_logs.tar; gzip -9 clickhouse_logs.tar"] diff --git a/docker/test/unit/Dockerfile b/docker/test/unit/Dockerfile index b75bfb6661c..378341ab8b6 100644 --- a/docker/test/unit/Dockerfile +++ b/docker/test/unit/Dockerfile @@ -1,7 +1,7 @@ # rebuild in #33610 # docker build -t clickhouse/unit-test . ARG FROM_TAG=latest -FROM clickhouse/stateless-test:$FROM_TAG +FROM altinityinfra/stateless-test:$FROM_TAG RUN apt-get install gdb diff --git a/packages/clickhouse-client.yaml b/packages/clickhouse-client.yaml index 6d1233e7c7a..efb509e622e 100644 --- a/packages/clickhouse-client.yaml +++ b/packages/clickhouse-client.yaml @@ -4,8 +4,8 @@ name: "clickhouse-client" arch: "${DEB_ARCH}" # amd64, arm64 platform: "linux" version: "${CLICKHOUSE_VERSION_STRING}" -vendor: "ClickHouse Inc." -homepage: "https://clickhouse.com" +vendor: "Altinity Inc." +homepage: "https://altinity.com/" license: "Apache" section: "database" priority: "optional" diff --git a/packages/clickhouse-common-static-dbg.yaml b/packages/clickhouse-common-static-dbg.yaml index 12a1594bd30..78f74ed15cb 100644 --- a/packages/clickhouse-common-static-dbg.yaml +++ b/packages/clickhouse-common-static-dbg.yaml @@ -4,8 +4,8 @@ name: "clickhouse-common-static-dbg" arch: "${DEB_ARCH}" # amd64, arm64 platform: "linux" version: "${CLICKHOUSE_VERSION_STRING}" -vendor: "ClickHouse Inc." -homepage: "https://clickhouse.com" +vendor: "Altinity Inc." +homepage: "https://altinity.com/" license: "Apache" section: "database" priority: "optional" diff --git a/packages/clickhouse-common-static.yaml b/packages/clickhouse-common-static.yaml index 269d4318e5e..07dee0d326b 100644 --- a/packages/clickhouse-common-static.yaml +++ b/packages/clickhouse-common-static.yaml @@ -4,8 +4,8 @@ name: "clickhouse-common-static" arch: "${DEB_ARCH}" # amd64, arm64 platform: "linux" version: "${CLICKHOUSE_VERSION_STRING}" -vendor: "ClickHouse Inc." -homepage: "https://clickhouse.com" +vendor: "Altinity Inc." +homepage: "https://altinity.com/" license: "Apache" section: "database" priority: "optional" diff --git a/packages/clickhouse-keeper-dbg.yaml b/packages/clickhouse-keeper-dbg.yaml index 2c70b7ad4aa..55bf5da74f2 100644 --- a/packages/clickhouse-keeper-dbg.yaml +++ b/packages/clickhouse-keeper-dbg.yaml @@ -4,8 +4,8 @@ name: "clickhouse-keeper-dbg" arch: "${DEB_ARCH}" # amd64, arm64 platform: "linux" version: "${CLICKHOUSE_VERSION_STRING}" -vendor: "ClickHouse Inc." -homepage: "https://clickhouse.com" +vendor: "Altinity Inc." +homepage: "https://altinity.com/" license: "Apache" section: "database" priority: "optional" diff --git a/packages/clickhouse-keeper.yaml b/packages/clickhouse-keeper.yaml index e99ac30f944..c8c0b1ad2b3 100644 --- a/packages/clickhouse-keeper.yaml +++ b/packages/clickhouse-keeper.yaml @@ -4,8 +4,8 @@ name: "clickhouse-keeper" arch: "${DEB_ARCH}" # amd64, arm64 platform: "linux" version: "${CLICKHOUSE_VERSION_STRING}" -vendor: "ClickHouse Inc." -homepage: "https://clickhouse.com" +vendor: "Altinity Inc." +homepage: "https://altinity.com/" license: "Apache" section: "database" priority: "optional" diff --git a/packages/clickhouse-server.yaml b/packages/clickhouse-server.yaml index 28995689754..e437deba879 100644 --- a/packages/clickhouse-server.yaml +++ b/packages/clickhouse-server.yaml @@ -4,8 +4,8 @@ name: "clickhouse-server" arch: "${DEB_ARCH}" # amd64, arm64 platform: "linux" version: "${CLICKHOUSE_VERSION_STRING}" -vendor: "ClickHouse Inc." -homepage: "https://clickhouse.com" +vendor: "Altinity Inc." +homepage: "https://altinity.com/" license: "Apache" section: "database" priority: "optional" diff --git a/src/Core/Settings.h b/src/Core/Settings.h index 0ed15de5f4b..9d405093f82 100644 --- a/src/Core/Settings.h +++ b/src/Core/Settings.h @@ -397,6 +397,7 @@ class IColumn; M(Bool, parallel_view_processing, false, "Enables pushing to attached views concurrently instead of sequentially.", 0) \ M(Bool, enable_unaligned_array_join, false, "Allow ARRAY JOIN with multiple arrays that have different sizes. When this settings is enabled, arrays will be resized to the longest one.", 0) \ M(Bool, optimize_read_in_order, true, "Enable ORDER BY optimization for reading data in corresponding order in MergeTree tables.", 0) \ + M(Bool, optimize_read_in_window_order, true, "Enable ORDER BY optimization in window clause for reading data in corresponding order in MergeTree tables.", 0) \ M(Bool, optimize_aggregation_in_order, false, "Enable GROUP BY optimization for aggregating data in corresponding order in MergeTree tables.", 0) \ M(UInt64, aggregation_in_order_max_block_bytes, 50000000, "Maximal size of block in bytes accumulated during aggregation in order of primary key. Lower block size allows to parallelize more final merge stage of aggregation.", 0) \ M(UInt64, read_in_order_two_level_merge_threshold, 100, "Minimal number of parts to read to run preliminary merge step during multithread reading in order of primary key.", 0) \ diff --git a/src/Disks/IDiskRemote.h b/src/Disks/IDiskRemote.h index 82e76b8f68d..4c91400c94c 100644 --- a/src/Disks/IDiskRemote.h +++ b/src/Disks/IDiskRemote.h @@ -165,9 +165,10 @@ friend class DiskRemoteReservation; DiskPtr metadata_disk; FileCachePtr cache; -private: +public: void removeMetadata(const String & path, RemoteFSPathKeeperPtr fs_paths_keeper); +private: void removeMetadataRecursive(const String & path, RemoteFSPathKeeperPtr fs_paths_keeper); bool tryReserve(UInt64 bytes); diff --git a/src/Disks/IO/ThreadPoolReader.cpp b/src/Disks/IO/ThreadPoolReader.cpp index 21f73c3129e..224b7d03b98 100644 --- a/src/Disks/IO/ThreadPoolReader.cpp +++ b/src/Disks/IO/ThreadPoolReader.cpp @@ -201,9 +201,9 @@ std::future ThreadPoolReader::submit(Request reques ProfileEvents::increment(ProfileEvents::ThreadPoolReaderPageCacheMiss); - ThreadGroupStatusPtr running_group = CurrentThread::isInitialized() && CurrentThread::get().getThreadGroup() - ? CurrentThread::get().getThreadGroup() - : MainThreadStatus::getInstance().getThreadGroup(); + ThreadGroupStatusPtr running_group; + if (CurrentThread::isInitialized() && CurrentThread::get().getThreadGroup()) + running_group = CurrentThread::get().getThreadGroup(); ContextPtr query_context; if (CurrentThread::isInitialized()) @@ -213,12 +213,17 @@ std::future ThreadPoolReader::submit(Request reques { ThreadStatus thread_status; - if (query_context) - thread_status.attachQueryContext(query_context); + SCOPE_EXIT({ + if (running_group) + thread_status.detachQuery(); + }); if (running_group) thread_status.attachQuery(running_group); + if (query_context) + thread_status.attachQueryContext(query_context); + setThreadName("ThreadPoolRead"); Stopwatch watch(CLOCK_MONOTONIC); @@ -253,9 +258,6 @@ std::future ThreadPoolReader::submit(Request reques ProfileEvents::increment(ProfileEvents::ThreadPoolReaderPageCacheMissElapsedMicroseconds, watch.elapsedMicroseconds()); ProfileEvents::increment(ProfileEvents::DiskReadElapsedMicroseconds, watch.elapsedMicroseconds()); - if (running_group) - thread_status.detachQuery(); - return Result{ .size = bytes_read, .offset = request.ignore }; }); diff --git a/src/Disks/IO/ThreadPoolRemoteFSReader.cpp b/src/Disks/IO/ThreadPoolRemoteFSReader.cpp index bdb012a6376..7652b4211aa 100644 --- a/src/Disks/IO/ThreadPoolRemoteFSReader.cpp +++ b/src/Disks/IO/ThreadPoolRemoteFSReader.cpp @@ -42,9 +42,9 @@ ThreadPoolRemoteFSReader::ThreadPoolRemoteFSReader(size_t pool_size, size_t queu std::future ThreadPoolRemoteFSReader::submit(Request request) { - ThreadGroupStatusPtr running_group = CurrentThread::isInitialized() && CurrentThread::get().getThreadGroup() - ? CurrentThread::get().getThreadGroup() - : MainThreadStatus::getInstance().getThreadGroup(); + ThreadGroupStatusPtr running_group; + if (CurrentThread::isInitialized() && CurrentThread::get().getThreadGroup()) + running_group = CurrentThread::get().getThreadGroup(); ContextPtr query_context; if (CurrentThread::isInitialized()) @@ -54,14 +54,19 @@ std::future ThreadPoolRemoteFSReader::submit(Reques { ThreadStatus thread_status; - /// Save query context if any, because cache implementation needs it. - if (query_context) - thread_status.attachQueryContext(query_context); + SCOPE_EXIT({ + if (running_group) + thread_status.detachQuery(); + }); /// To be able to pass ProfileEvents. if (running_group) thread_status.attachQuery(running_group); + /// Save query context if any, because cache implementation needs it. + if (query_context) + thread_status.attachQueryContext(query_context); + setThreadName("VFSRead"); CurrentMetrics::Increment metric_increment{CurrentMetrics::Read}; @@ -74,9 +79,6 @@ std::future ThreadPoolRemoteFSReader::submit(Reques ProfileEvents::increment(ProfileEvents::RemoteFSReadMicroseconds, watch.elapsedMicroseconds()); ProfileEvents::increment(ProfileEvents::RemoteFSReadBytes, bytes_read); - if (running_group) - thread_status.detachQuery(); - return Result{ .size = bytes_read, .offset = offset }; }); diff --git a/src/Disks/S3/DiskS3.cpp b/src/Disks/S3/DiskS3.cpp index e46620d9d1f..723b1e7373c 100644 --- a/src/Disks/S3/DiskS3.cpp +++ b/src/Disks/S3/DiskS3.cpp @@ -11,7 +11,6 @@ #include #include -#include #include #include @@ -35,6 +34,7 @@ #include #include +#include #include #include #include @@ -57,52 +57,6 @@ namespace ErrorCodes extern const int LOGICAL_ERROR; } -/// Helper class to collect keys into chunks of maximum size (to prepare batch requests to AWS API) -/// see https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html -class S3PathKeeper : public RemoteFSPathKeeper -{ -public: - using Chunk = Aws::Vector; - using Chunks = std::list; - - explicit S3PathKeeper(size_t chunk_limit_) : RemoteFSPathKeeper(chunk_limit_) {} - - void addPath(const String & path) override - { - if (chunks.empty() || chunks.back().size() >= chunk_limit) - { - /// add one more chunk - chunks.push_back(Chunks::value_type()); - chunks.back().reserve(chunk_limit); - } - Aws::S3::Model::ObjectIdentifier obj; - obj.SetKey(path); - chunks.back().push_back(obj); - } - - void removePaths(Fn auto && remove_chunk_func) - { - for (auto & chunk : chunks) - remove_chunk_func(std::move(chunk)); - } - - static String getChunkKeys(const Chunk & chunk) - { - String res; - for (const auto & obj : chunk) - { - const auto & key = obj.GetKey(); - if (!res.empty()) - res.append(", "); - res.append(key.c_str(), key.size()); - } - return res; - } - -private: - Chunks chunks; -}; - template void throwIfError(Aws::Utils::Outcome & response) { @@ -155,12 +109,14 @@ DiskS3::DiskS3( DiskPtr metadata_disk_, FileCachePtr cache_, ContextPtr context_, + const S3Capabilities & s3_capabilities_, SettingsPtr settings_, GetDiskSettings settings_getter_) : IDiskRemote(name_, s3_root_path_, metadata_disk_, std::move(cache_), "DiskS3", settings_->thread_pool_size) , bucket(std::move(bucket_)) , current_settings(std::move(settings_)) , settings_getter(settings_getter_) + , s3_capabilities(s3_capabilities_) , context(context_) { } @@ -180,15 +136,31 @@ void DiskS3::removeFromRemoteFS(RemoteFSPathKeeperPtr fs_paths_keeper) s3_paths_keeper->removePaths([&](S3PathKeeper::Chunk && chunk) { String keys = S3PathKeeper::getChunkKeys(chunk); - LOG_TRACE(log, "Remove AWS keys {}", keys); - Aws::S3::Model::Delete delkeys; - delkeys.SetObjects(chunk); - Aws::S3::Model::DeleteObjectsRequest request; - request.SetBucket(bucket); - request.SetDelete(delkeys); - auto outcome = settings->client->DeleteObjects(request); - // Do not throw here, continue deleting other chunks - logIfError(outcome, [&](){return "Can't remove AWS keys: " + keys;}); + if (!s3_capabilities.support_batch_delete) + { + LOG_TRACE(log, "Remove AWS keys {} one by one", keys); + for (const auto & obj : chunk) + { + Aws::S3::Model::DeleteObjectRequest request; + request.SetBucket(bucket); + request.SetKey(obj.GetKey()); + auto outcome = settings->client->DeleteObject(request); + // Do not throw here, continue deleting other keys and chunks + logIfError(outcome, [&](){return "Can't remove AWS key: " + obj.GetKey();}); + } + } + else + { + LOG_TRACE(log, "Remove AWS keys {}", keys); + Aws::S3::Model::Delete delkeys; + delkeys.SetObjects(chunk); + Aws::S3::Model::DeleteObjectsRequest request; + request.SetBucket(bucket); + request.SetDelete(delkeys); + auto outcome = settings->client->DeleteObjects(request); + // Do not throw here, continue deleting other chunks + logIfError(outcome, [&](){return "Can't remove AWS keys: " + keys;}); + } }); } diff --git a/src/Disks/S3/DiskS3.h b/src/Disks/S3/DiskS3.h index 2de1600d906..473dc6a7a75 100644 --- a/src/Disks/S3/DiskS3.h +++ b/src/Disks/S3/DiskS3.h @@ -7,12 +7,15 @@ #include #include #include +#include #include "Disks/DiskFactory.h" #include "Disks/Executor.h" +#include #include #include #include +#include #include #include @@ -76,6 +79,7 @@ class DiskS3 final : public IDiskRemote DiskPtr metadata_disk_, FileCachePtr cache_, ContextPtr context_, + const S3Capabilities & s3_capabilities_, SettingsPtr settings_, GetDiskSettings settings_getter_); @@ -119,6 +123,8 @@ class DiskS3 final : public IDiskRemote void applyNewSettings(const Poco::Util::AbstractConfiguration & config, ContextPtr context, const String &, const DisksMap &) override; + void setCapabilitiesSupportBatchDelete(bool value) { s3_capabilities.support_batch_delete = value; } + private: void createFileOperationObject(const String & operation_name, UInt64 revision, const ObjectMetadata & metadata); /// Converts revision to binary string with leading zeroes (64 bit). @@ -166,6 +172,7 @@ class DiskS3 final : public IDiskRemote MultiVersion current_settings; /// Gets disk settings from context. GetDiskSettings settings_getter; + S3Capabilities s3_capabilities; std::atomic revision_counter = 0; static constexpr UInt64 LATEST_REVISION = std::numeric_limits::max(); @@ -187,6 +194,57 @@ class DiskS3 final : public IDiskRemote ContextPtr context; }; +/// Helper class to collect keys into chunks of maximum size (to prepare batch requests to AWS API) +/// see https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjects.html +class S3PathKeeper : public RemoteFSPathKeeper +{ +public: + using Chunk = Aws::Vector; + using Chunks = std::list; + + explicit S3PathKeeper(size_t chunk_limit_) : RemoteFSPathKeeper(chunk_limit_) {} + + void addPath(const String & path) override + { + if (chunks.empty() || chunks.back().size() >= chunk_limit) + { + /// add one more chunk + chunks.push_back(Chunks::value_type()); + chunks.back().reserve(chunk_limit); + } + Aws::S3::Model::ObjectIdentifier obj; + obj.SetKey(path); + chunks.back().push_back(obj); + } + + void removePaths(Fn auto && remove_chunk_func) + { + for (auto & chunk : chunks) + remove_chunk_func(std::move(chunk)); + } + + Chunks getChunks() const + { + return chunks; + } + + static String getChunkKeys(const Chunk & chunk) + { + String res; + for (const auto & obj : chunk) + { + const auto & key = obj.GetKey(); + if (!res.empty()) + res.append(", "); + res.append(key.c_str(), key.size()); + } + return res; + } + +private: + Chunks chunks; +}; + } #endif diff --git a/src/Disks/S3/S3Capabilities.cpp b/src/Disks/S3/S3Capabilities.cpp new file mode 100644 index 00000000000..f96f0b5539a --- /dev/null +++ b/src/Disks/S3/S3Capabilities.cpp @@ -0,0 +1,15 @@ +#include + +namespace DB +{ + +S3Capabilities getCapabilitiesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix) +{ + return S3Capabilities + { + .support_batch_delete = config.getBool(config_prefix + ".support_batch_delete", true), + .support_proxy = config.getBool(config_prefix + ".support_proxy", config.has(config_prefix + ".proxy")), + }; +} + +} diff --git a/src/Disks/S3/S3Capabilities.h b/src/Disks/S3/S3Capabilities.h new file mode 100644 index 00000000000..46e647da89e --- /dev/null +++ b/src/Disks/S3/S3Capabilities.h @@ -0,0 +1,27 @@ +#pragma once + +#include +#include + +namespace DB +{ + +/// Supported/unsupported features by different S3 implementations +/// Can be useful only for almost compatible with AWS S3 versions. +struct S3Capabilities +{ + /// Google S3 implementation doesn't support batch delete + /// TODO: possibly we have to use Google SDK https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/storage + /// because looks like it miss a lot of features like: + /// 1) batch delete + /// 2) list_v2 + /// 3) multipart upload works differently + bool support_batch_delete{true}; + + /// Y.Cloud S3 implementation support proxy for connection + bool support_proxy{false}; +}; + +S3Capabilities getCapabilitiesFromConfig(const Poco::Util::AbstractConfiguration & config, const std::string & config_prefix); + +} diff --git a/src/Disks/S3/registerDiskS3.cpp b/src/Disks/S3/registerDiskS3.cpp index 2b5fe3c5a81..474378f4f3e 100644 --- a/src/Disks/S3/registerDiskS3.cpp +++ b/src/Disks/S3/registerDiskS3.cpp @@ -9,6 +9,8 @@ #if USE_AWS_S3 #include +#include +#include #include #include "DiskS3.h" #include "Disks/DiskCacheWrapper.h" @@ -21,6 +23,7 @@ #include "Disks/RemoteDisksCommon.h" #include + namespace DB { namespace ErrorCodes @@ -46,7 +49,79 @@ void checkReadAccess(const String & disk_name, IDisk & disk) throw Exception("No read access to S3 bucket in disk " + disk_name, ErrorCodes::PATH_ACCESS_DENIED); } -void checkRemoveAccess(IDisk & disk) { disk.removeFile("test_acl"); } +void checkRemoveAccess(IDisk & disk) +{ + disk.removeFile("test_acl"); +} + +bool checkBatchRemoveIsMissing(DiskS3 & disk, std::unique_ptr settings, const String & bucket) +{ + const String path = "_test_remove_objects_capability"; + try + { + auto file = disk.writeFile(path, DBMS_DEFAULT_BUFFER_SIZE, WriteMode::Rewrite); + file->write("test", 4); + file->finalize(); + } + catch (...) + { + try + { + disk.removeFile(path); + } + catch (...) + { + } + return false; /// We don't have write access, therefore no information about batch remove. + } + + /// See `IDiskRemote::removeSharedFile`. + auto fs_paths_keeper = std::dynamic_pointer_cast(disk.createFSPathKeeper()); + disk.removeMetadata(path, fs_paths_keeper); + + auto fs_paths_keeper_copy = std::dynamic_pointer_cast(disk.createFSPathKeeper()); + for (const auto & chunk : fs_paths_keeper->getChunks()) + for (const auto & obj : chunk) + fs_paths_keeper_copy->addPath(obj.GetKey()); + + try + { + /// See `DiskS3::removeFromRemoteFS`. + fs_paths_keeper->removePaths([&](S3PathKeeper::Chunk && chunk) + { + String keys = S3PathKeeper::getChunkKeys(chunk); + LOG_TRACE(&Poco::Logger::get("registerDiskS3"), "Remove AWS keys {}", keys); + Aws::S3::Model::Delete delkeys; + delkeys.SetObjects(chunk); + Aws::S3::Model::DeleteObjectsRequest request; + request.SetBucket(bucket); + request.SetDelete(delkeys); + auto outcome = settings->client->DeleteObjects(request); + if (!outcome.IsSuccess()) + { + const auto & err = outcome.GetError(); + throw Exception(err.GetMessage(), static_cast(err.GetErrorType())); + } + }); + return false; + } + catch (const Exception &) + { + fs_paths_keeper_copy->removePaths([&](S3PathKeeper::Chunk && chunk) + { + String keys = S3PathKeeper::getChunkKeys(chunk); + LOG_TRACE(&Poco::Logger::get("registerDiskS3"), "Remove AWS keys {} one by one", keys); + for (const auto & obj : chunk) + { + Aws::S3::Model::DeleteObjectRequest request; + request.SetBucket(bucket); + request.SetKey(obj.GetKey()); + settings->client->DeleteObject(request); + } + }); + return true; + } +} std::shared_ptr getProxyResolverConfiguration( const String & prefix, const Poco::Util::AbstractConfiguration & proxy_resolver_config) @@ -187,6 +262,7 @@ void registerDiskS3(DiskFactory & factory) auto [metadata_path, metadata_disk] = prepareForLocalMetadata(name, config, config_prefix, context); FileCachePtr cache = getCachePtrForDisk(name, config, config_prefix, context); + S3Capabilities s3_capabilities = getCapabilitiesFromConfig(config, config_prefix); std::shared_ptr s3disk = std::make_shared( name, @@ -195,11 +271,30 @@ void registerDiskS3(DiskFactory & factory) metadata_disk, std::move(cache), context, + s3_capabilities, getSettings(config, config_prefix, context), getSettings); + bool skip_access_check = config.getBool(config_prefix + ".skip_access_check", false); + + if (!skip_access_check) + { + /// If `support_batch_delete` is turned on (default), check and possibly switch it off. + if (s3_capabilities.support_batch_delete && checkBatchRemoveIsMissing(*std::dynamic_pointer_cast(s3disk), getSettings(config, config_prefix, context), uri.bucket)) + { + LOG_WARNING( + &Poco::Logger::get("registerDiskS3"), + "Storage for disk {} does not support batch delete operations, " + "so `s3_capabilities.support_batch_delete` was automatically turned off during the access check. " + "To remove this message set `s3_capabilities.support_batch_delete` for the disk to `false`.", + name + ); + std::dynamic_pointer_cast(s3disk)->setCapabilitiesSupportBatchDelete(false); + } + } + /// This code is used only to check access to the corresponding disk. - if (!config.getBool(config_prefix + ".skip_access_check", false)) + if (!skip_access_check) { checkWriteAccess(*s3disk); checkReadAccess(name, *s3disk); diff --git a/src/IO/WriteBufferFromS3.cpp b/src/IO/WriteBufferFromS3.cpp index eda7bb6f8ae..de7130319a7 100644 --- a/src/IO/WriteBufferFromS3.cpp +++ b/src/IO/WriteBufferFromS3.cpp @@ -86,7 +86,6 @@ void WriteBufferFromS3::nextImpl() temporary_buffer->write(working_buffer.begin(), offset()); ProfileEvents::increment(ProfileEvents::S3WriteBytes, offset()); - last_part_size += offset(); /// Data size exceeds singlepart upload threshold, need to use multipart upload. diff --git a/src/Interpreters/ExpressionAnalyzer.cpp b/src/Interpreters/ExpressionAnalyzer.cpp index e3191fefa00..bc2745ce19d 100644 --- a/src/Interpreters/ExpressionAnalyzer.cpp +++ b/src/Interpreters/ExpressionAnalyzer.cpp @@ -607,7 +607,7 @@ void ExpressionAnalyzer::makeAggregateDescriptions(ActionsDAGPtr & actions, Aggr } } -void makeWindowDescriptionFromAST(const Context & context, +void ExpressionAnalyzer::makeWindowDescriptionFromAST(const Context & context_, const WindowDescriptions & existing_descriptions, WindowDescription & desc, const IAST * ast) { @@ -676,6 +676,10 @@ void makeWindowDescriptionFromAST(const Context & context, desc.partition_by.push_back(SortColumnDescription( with_alias->getColumnName(), 1 /* direction */, 1 /* nulls_direction */)); + + auto actions_dag = std::make_shared(aggregated_columns); + getRootActions(column_ast, false, actions_dag); + desc.partition_by_actions.push_back(std::move(actions_dag)); } } @@ -693,6 +697,10 @@ void makeWindowDescriptionFromAST(const Context & context, order_by_element.children.front()->getColumnName(), order_by_element.direction, order_by_element.nulls_direction)); + + auto actions_dag = std::make_shared(aggregated_columns); + getRootActions(column_ast, false, actions_dag); + desc.order_by_actions.push_back(std::move(actions_dag)); } } @@ -719,14 +727,14 @@ void makeWindowDescriptionFromAST(const Context & context, if (definition.frame_end_type == WindowFrame::BoundaryType::Offset) { auto [value, _] = evaluateConstantExpression(definition.frame_end_offset, - context.shared_from_this()); + context_.shared_from_this()); desc.frame.end_offset = value; } if (definition.frame_begin_type == WindowFrame::BoundaryType::Offset) { auto [value, _] = evaluateConstantExpression(definition.frame_begin_offset, - context.shared_from_this()); + context_.shared_from_this()); desc.frame.begin_offset = value; } } diff --git a/src/Interpreters/ExpressionAnalyzer.h b/src/Interpreters/ExpressionAnalyzer.h index a034dd57393..6e3bc3f81b4 100644 --- a/src/Interpreters/ExpressionAnalyzer.h +++ b/src/Interpreters/ExpressionAnalyzer.h @@ -132,6 +132,7 @@ class ExpressionAnalyzer : protected ExpressionAnalyzerData, private boost::nonc /// A list of windows for window functions. const WindowDescriptions & windowDescriptions() const { return window_descriptions; } + void makeWindowDescriptionFromAST(const Context & context, const WindowDescriptions & existing_descriptions, WindowDescription & desc, const IAST * ast); void makeWindowDescriptions(ActionsDAGPtr actions); /** diff --git a/src/Interpreters/InterpreterSelectQuery.cpp b/src/Interpreters/InterpreterSelectQuery.cpp index 35d20be4655..ffa094a82ae 100644 --- a/src/Interpreters/InterpreterSelectQuery.cpp +++ b/src/Interpreters/InterpreterSelectQuery.cpp @@ -811,7 +811,7 @@ static FillColumnDescription getWithFillDescription(const ASTOrderByElement & or return descr; } -static SortDescription getSortDescription(const ASTSelectQuery & query, ContextPtr context) +SortDescription InterpreterSelectQuery::getSortDescription(const ASTSelectQuery & query, ContextPtr context_) { SortDescription order_descr; order_descr.reserve(query.orderBy()->children.size()); @@ -826,7 +826,7 @@ static SortDescription getSortDescription(const ASTSelectQuery & query, ContextP if (order_by_elem.with_fill) { - FillColumnDescription fill_desc = getWithFillDescription(order_by_elem, context); + FillColumnDescription fill_desc = getWithFillDescription(order_by_elem, context_); order_descr.emplace_back(name, order_by_elem.direction, order_by_elem.nulls_direction, collator, true, fill_desc); } else @@ -885,12 +885,12 @@ static std::pair getLimitLengthAndOffset(const ASTSelectQuery & } -static UInt64 getLimitForSorting(const ASTSelectQuery & query, ContextPtr context) +UInt64 InterpreterSelectQuery::getLimitForSorting(const ASTSelectQuery & query, ContextPtr context_) { /// Partial sort can be done if there is LIMIT but no DISTINCT or LIMIT BY, neither ARRAY JOIN. if (!query.distinct && !query.limitBy() && !query.limit_with_ties && !query.arrayJoinExpressionList().first && query.limitLength()) { - auto [limit_length, limit_offset] = getLimitLengthAndOffset(query, context); + auto [limit_length, limit_offset] = getLimitLengthAndOffset(query, context_); if (limit_length > std::numeric_limits::max() - limit_offset) return 0; diff --git a/src/Interpreters/InterpreterSelectQuery.h b/src/Interpreters/InterpreterSelectQuery.h index aa41d837601..0eb6ae06e82 100644 --- a/src/Interpreters/InterpreterSelectQuery.h +++ b/src/Interpreters/InterpreterSelectQuery.h @@ -106,6 +106,9 @@ class InterpreterSelectQuery : public IInterpreterUnionOrSelectQuery Names getRequiredColumns() { return required_columns; } + static SortDescription getSortDescription(const ASTSelectQuery & query, ContextPtr context); + static UInt64 getLimitForSorting(const ASTSelectQuery & query, ContextPtr context); + private: InterpreterSelectQuery( const ASTPtr & query_ptr_, diff --git a/src/Interpreters/RequiredSourceColumnsVisitor.cpp b/src/Interpreters/RequiredSourceColumnsVisitor.cpp index 21ec94a6917..2f2a68656bc 100644 --- a/src/Interpreters/RequiredSourceColumnsVisitor.cpp +++ b/src/Interpreters/RequiredSourceColumnsVisitor.cpp @@ -123,17 +123,6 @@ void RequiredSourceColumnsMatcher::visit(const ASTSelectQuery & select, const AS data.addColumnAliasIfAny(*node); } - if (const auto & with = select.with()) - { - for (auto & node : with->children) - { - if (const auto * identifier = node->as()) - data.addColumnIdentifier(*identifier); - else - data.addColumnAliasIfAny(*node); - } - } - std::vector out; for (const auto & node : select.children) { diff --git a/src/Interpreters/ThreadStatusExt.cpp b/src/Interpreters/ThreadStatusExt.cpp index 2ea371d3d03..1f2a8e4681a 100644 --- a/src/Interpreters/ThreadStatusExt.cpp +++ b/src/Interpreters/ThreadStatusExt.cpp @@ -408,6 +408,11 @@ void ThreadStatus::detachQuery(bool exit_if_already_detached, bool thread_exits) query_context.reset(); thread_trace_context.trace_id = 0; thread_trace_context.span_id = 0; + + /// Avoid leaking of ThreadGroupStatus::finished_threads_counters_memory + /// (this is in case someone uses system thread but did not call getProfileEventsCountersAndMemoryForThreads()) + thread_group->getProfileEventsCountersAndMemoryForThreads(); + thread_group.reset(); thread_state = thread_exits ? ThreadState::Died : ThreadState::DetachedFromQuery; diff --git a/src/Interpreters/WindowDescription.h b/src/Interpreters/WindowDescription.h index bb0130b4d4e..65c8cb9423c 100644 --- a/src/Interpreters/WindowDescription.h +++ b/src/Interpreters/WindowDescription.h @@ -7,6 +7,7 @@ #include #include #include +#include namespace DB { @@ -90,6 +91,9 @@ struct WindowDescription // then by ORDER BY. This field holds this combined sort order. SortDescription full_sort_description; + std::vector partition_by_actions; + std::vector order_by_actions; + WindowFrame frame; // The window functions that are calculated for this window. diff --git a/src/Processors/Formats/Impl/ParquetBlockInputFormat.cpp b/src/Processors/Formats/Impl/ParquetBlockInputFormat.cpp index 548bf0138f5..1749b5b62aa 100644 --- a/src/Processors/Formats/Impl/ParquetBlockInputFormat.cpp +++ b/src/Processors/Formats/Impl/ParquetBlockInputFormat.cpp @@ -51,7 +51,16 @@ Chunk ParquetBlockInputFormat::generate() return res; std::shared_ptr table; - arrow::Status read_status = file_reader->ReadRowGroup(row_group_current, column_indices, &table); + + std::unique_ptr<::arrow::RecordBatchReader> rbr; + std::vector row_group_indices { row_group_current }; + arrow::Status get_batch_reader_status = file_reader->GetRecordBatchReader(row_group_indices, column_indices, &rbr); + + if (!get_batch_reader_status.ok()) + throw ParsingException{"Error while reading Parquet data: " + get_batch_reader_status.ToString(), ErrorCodes::CANNOT_READ_ALL_DATA}; + + arrow::Status read_status = rbr->ReadAll(&table); + if (!read_status.ok()) throw ParsingException{"Error while reading Parquet data: " + read_status.ToString(), ErrorCodes::CANNOT_READ_ALL_DATA}; diff --git a/src/Processors/QueryPlan/Optimizations/Optimizations.h b/src/Processors/QueryPlan/Optimizations/Optimizations.h index 10bc6293537..11bdb1c95e5 100644 --- a/src/Processors/QueryPlan/Optimizations/Optimizations.h +++ b/src/Processors/QueryPlan/Optimizations/Optimizations.h @@ -44,16 +44,21 @@ size_t tryMergeExpressions(QueryPlan::Node * parent_node, QueryPlan::Nodes &); /// May split FilterStep and push down only part of it. size_t tryPushDownFilter(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes); +/// Utilize storage sorting when sorting for window functions. +/// Update information about prefix sort description in SortingStep. +size_t tryReuseStorageOrderingForWindowFunctions(QueryPlan::Node * parent_node, QueryPlan::Nodes & nodes); + inline const auto & getOptimizations() { - static const std::array optimizations = + static const std::array optimizations = {{ {tryLiftUpArrayJoin, "liftUpArrayJoin", &QueryPlanOptimizationSettings::optimize_plan}, {tryPushDownLimit, "pushDownLimit", &QueryPlanOptimizationSettings::optimize_plan}, {trySplitFilter, "splitFilter", &QueryPlanOptimizationSettings::optimize_plan}, {tryMergeExpressions, "mergeExpressions", &QueryPlanOptimizationSettings::optimize_plan}, {tryPushDownFilter, "pushDownFilter", &QueryPlanOptimizationSettings::filter_push_down}, - }}; + {tryReuseStorageOrderingForWindowFunctions, "reuseStorageOrderingForWindowFunctions", &QueryPlanOptimizationSettings::optimize_plan} + }}; return optimizations; } diff --git a/src/Processors/QueryPlan/Optimizations/reuseStorageOrderingForWindowFunctions.cpp b/src/Processors/QueryPlan/Optimizations/reuseStorageOrderingForWindowFunctions.cpp new file mode 100644 index 00000000000..547e29106a4 --- /dev/null +++ b/src/Processors/QueryPlan/Optimizations/reuseStorageOrderingForWindowFunctions.cpp @@ -0,0 +1,122 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace DB::QueryPlanOptimizations +{ + +size_t tryReuseStorageOrderingForWindowFunctions(QueryPlan::Node * parent_node, QueryPlan::Nodes & /*nodes*/) +{ + /// Find the following sequence of steps, add InputOrderInfo and apply prefix sort description to + /// SortingStep: + /// WindowStep <- SortingStep <- [Expression] <- ReadFromMergeTree + + auto * window_node = parent_node; + auto * window = typeid_cast(window_node->step.get()); + if (!window) + return 0; + if (window_node->children.size() != 1) + return 0; + + auto * sorting_node = window_node->children.front(); + auto * sorting = typeid_cast(sorting_node->step.get()); + if (!sorting) + return 0; + if (sorting_node->children.size() != 1) + return 0; + + auto * possible_read_from_merge_tree_node = sorting_node->children.front(); + + if (typeid_cast(possible_read_from_merge_tree_node->step.get())) + { + if (possible_read_from_merge_tree_node->children.size() != 1) + return 0; + + possible_read_from_merge_tree_node = possible_read_from_merge_tree_node->children.front(); + } + + if (typeid_cast(possible_read_from_merge_tree_node->step.get())) + { + if (possible_read_from_merge_tree_node->children.size() != 1) + return 0; + + possible_read_from_merge_tree_node = possible_read_from_merge_tree_node->children.front(); + } + + auto * read_from_merge_tree = typeid_cast(possible_read_from_merge_tree_node->step.get()); + if (!read_from_merge_tree) + { + return 0; + } + + auto context = read_from_merge_tree->getContext(); + if (!context->getSettings().optimize_read_in_window_order) + { + return 0; + } + + const auto & query_info = read_from_merge_tree->getQueryInfo(); + const auto * select_query = query_info.query->as(); + + ManyExpressionActions order_by_elements_actions; + const auto & window_desc = window->getWindowDescription(); + + for (const auto & actions_dag : window_desc.partition_by_actions) + { + order_by_elements_actions.emplace_back( + std::make_shared(actions_dag, ExpressionActionsSettings::fromContext(context, CompileExpressions::yes))); + } + + for (const auto & actions_dag : window_desc.order_by_actions) + { + order_by_elements_actions.emplace_back( + std::make_shared(actions_dag, ExpressionActionsSettings::fromContext(context, CompileExpressions::yes))); + } + + auto order_optimizer = std::make_shared( + *select_query, + order_by_elements_actions, + window->getWindowDescription().full_sort_description, + query_info.syntax_analyzer_result); + + read_from_merge_tree->setQueryInfoOrderOptimizer(order_optimizer); + + /// If we don't have filtration, we can pushdown limit to reading stage for optimizations. + UInt64 limit = (select_query->hasFiltration() || select_query->groupBy()) ? 0 : InterpreterSelectQuery::getLimitForSorting(*select_query, context); + + auto order_info = order_optimizer->getInputOrder( + query_info.projection ? query_info.projection->desc->metadata : read_from_merge_tree->getStorageMetadata(), + context, + limit); + + if (order_info) + { + read_from_merge_tree->setQueryInfoInputOrderInfo(order_info); + sorting->convertToFinishSorting(order_info->order_key_prefix_descr); + } + + return 0; +} + +} diff --git a/src/Processors/QueryPlan/ReadFromMergeTree.cpp b/src/Processors/QueryPlan/ReadFromMergeTree.cpp index 1bfc1ec7306..abc753c5fa7 100644 --- a/src/Processors/QueryPlan/ReadFromMergeTree.cpp +++ b/src/Processors/QueryPlan/ReadFromMergeTree.cpp @@ -977,6 +977,30 @@ MergeTreeDataSelectAnalysisResultPtr ReadFromMergeTree::selectRangesToRead( return std::make_shared(MergeTreeDataSelectAnalysisResult{.result = std::move(result)}); } +void ReadFromMergeTree::setQueryInfoOrderOptimizer(std::shared_ptr order_optimizer) +{ + if (query_info.projection) + { + query_info.projection->order_optimizer = order_optimizer; + } + else + { + query_info.order_optimizer = order_optimizer; + } +} + +void ReadFromMergeTree::setQueryInfoInputOrderInfo(InputOrderInfoPtr order_info) +{ + if (query_info.projection) + { + query_info.projection->input_order_info = order_info; + } + else + { + query_info.input_order_info = order_info; + } +} + ReadFromMergeTree::AnalysisResult ReadFromMergeTree::getAnalysisResult() const { auto result_ptr = analyzed_result_ptr ? analyzed_result_ptr : selectRangesToRead(prepared_parts); @@ -1060,7 +1084,7 @@ void ReadFromMergeTree::initializePipeline(QueryPipelineBuilder & pipeline, cons column_names_to_read, result_projection); } - else if ((settings.optimize_read_in_order || settings.optimize_aggregation_in_order) && input_order_info) + else if ((settings.optimize_read_in_order || settings.optimize_aggregation_in_order || settings.optimize_read_in_window_order) && input_order_info) { pipe = spreadMarkRangesAmongStreamsWithOrder( std::move(result.parts_with_ranges), diff --git a/src/Processors/QueryPlan/ReadFromMergeTree.h b/src/Processors/QueryPlan/ReadFromMergeTree.h index 685b99a7bdc..16333edcaf3 100644 --- a/src/Processors/QueryPlan/ReadFromMergeTree.h +++ b/src/Processors/QueryPlan/ReadFromMergeTree.h @@ -128,6 +128,13 @@ class ReadFromMergeTree final : public ISourceStep bool sample_factor_column_queried, Poco::Logger * log); + ContextPtr getContext() const { return context; } + const SelectQueryInfo & getQueryInfo() const { return query_info; } + StorageMetadataPtr getStorageMetadata() const { return metadata_for_reading; } + + void setQueryInfoOrderOptimizer(std::shared_ptr read_in_order_optimizer); + void setQueryInfoInputOrderInfo(InputOrderInfoPtr order_info); + private: const MergeTreeReaderSettings reader_settings; diff --git a/src/Processors/QueryPlan/SortingStep.cpp b/src/Processors/QueryPlan/SortingStep.cpp index 32b314b1c50..602680e1718 100644 --- a/src/Processors/QueryPlan/SortingStep.cpp +++ b/src/Processors/QueryPlan/SortingStep.cpp @@ -97,6 +97,12 @@ void SortingStep::updateLimit(size_t limit_) } } +void SortingStep::convertToFinishSorting(SortDescription prefix_description_) +{ + type = Type::FinishSorting; + prefix_description = std::move(prefix_description_); +} + void SortingStep::transformPipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings &) { if (type == Type::FinishSorting) diff --git a/src/Processors/QueryPlan/SortingStep.h b/src/Processors/QueryPlan/SortingStep.h index 8e253e71f44..4da98a15f65 100644 --- a/src/Processors/QueryPlan/SortingStep.h +++ b/src/Processors/QueryPlan/SortingStep.h @@ -49,6 +49,8 @@ class SortingStep : public ITransformingStep /// Add limit or change it to lower value. void updateLimit(size_t limit_); + void convertToFinishSorting(SortDescription prefix_description); + private: enum class Type diff --git a/src/Processors/QueryPlan/WindowStep.cpp b/src/Processors/QueryPlan/WindowStep.cpp index cd4bb5f6730..0916b43b29a 100644 --- a/src/Processors/QueryPlan/WindowStep.cpp +++ b/src/Processors/QueryPlan/WindowStep.cpp @@ -138,4 +138,9 @@ void WindowStep::describeActions(JSONBuilder::JSONMap & map) const map.add("Functions", std::move(functions_array)); } +const WindowDescription & WindowStep::getWindowDescription() const +{ + return window_description; +} + } diff --git a/src/Processors/QueryPlan/WindowStep.h b/src/Processors/QueryPlan/WindowStep.h index a65b157f481..9b58cceb972 100644 --- a/src/Processors/QueryPlan/WindowStep.h +++ b/src/Processors/QueryPlan/WindowStep.h @@ -25,6 +25,8 @@ class WindowStep : public ITransformingStep void describeActions(JSONBuilder::JSONMap & map) const override; void describeActions(FormatSettings & settings) const override; + const WindowDescription & getWindowDescription() const; + private: WindowDescription window_description; std::vector window_functions; diff --git a/src/Processors/Transforms/WindowTransform.cpp b/src/Processors/Transforms/WindowTransform.cpp index b81ed099915..b7e02c27adf 100644 --- a/src/Processors/Transforms/WindowTransform.cpp +++ b/src/Processors/Transforms/WindowTransform.cpp @@ -1,5 +1,7 @@ #include +#include + #include #include #include @@ -14,6 +16,7 @@ #include #include + namespace DB { @@ -962,9 +965,6 @@ void WindowTransform::updateAggregationState() } } } - - prev_frame_start = frame_start; - prev_frame_end = frame_end; } void WindowTransform::writeOutCurrentRow() @@ -1206,6 +1206,9 @@ void WindowTransform::appendChunk(Chunk & chunk) return; } + prev_frame_start = frame_start; + prev_frame_end = frame_end; + // Move to the next row. The frame will have to be recalculated. // The peer group start is updated at the beginning of the loop, // because current_row might now be past-the-end. @@ -1538,65 +1541,21 @@ struct WindowFunctionDenseRank final : public WindowFunction namespace recurrent_detail { - template T getLastValueFromInputColumn(const WindowTransform * /*transform*/, size_t /*function_index*/, size_t /*column_index*/) - { - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "getLastValueFromInputColumn() is not implemented for {} type", typeid(T).name()); - } - - template<> Float64 getLastValueFromInputColumn(const WindowTransform * transform, size_t function_index, size_t column_index) - { - const auto & workspace = transform->workspaces[function_index]; - auto current_row = transform->current_row; - - if (current_row.row == 0) - { - if (current_row.block > 0) - { - const auto & column = transform->blockAt(current_row.block - 1).input_columns[workspace.argument_column_indices[column_index]]; - return column->getFloat64(column->size() - 1); - } - } - else - { - const auto & column = transform->blockAt(current_row.block).input_columns[workspace.argument_column_indices[column_index]]; - return column->getFloat64(current_row.row - 1); - } - - return 0; - } - - template T getLastValueFromState(const WindowTransform * /*transform*/, size_t /*function_index*/, size_t /*data_index*/) - { - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "getLastValueFromInputColumn() is not implemented for {} type", typeid(T).name()); - } - - template<> Float64 getLastValueFromState(const WindowTransform * transform, size_t function_index, size_t data_index) - { - const auto & workspace = transform->workspaces[function_index]; - if (workspace.aggregate_function_state.data() == nullptr) - { - return 0.0; - } - else - { - return static_cast(static_cast(workspace.aggregate_function_state.data()))[data_index]; - } - } - - template void setValueToState(const WindowTransform * /*transform*/, size_t /*function_index*/, T /*value*/, size_t /*data_index*/) + template T getValue(const WindowTransform * /*transform*/, size_t /*function_index*/, size_t /*column_index*/, RowNumber /*row*/) { - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "setValueToState() is not implemented for {} type", typeid(T).name()); + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "recurrent_detail::getValue() is not implemented for {} type", typeid(T).name()); } - template<> void setValueToState(const WindowTransform * transform, size_t function_index, Float64 value, size_t data_index) + template<> Float64 getValue(const WindowTransform * transform, size_t function_index, size_t column_index, RowNumber row) { const auto & workspace = transform->workspaces[function_index]; - static_cast(static_cast(workspace.aggregate_function_state.data()))[data_index] = value; + const auto & column = transform->blockAt(row.block).input_columns[workspace.argument_column_indices[column_index]]; + return column->getFloat64(row.row); } template void setValueToOutputColumn(const WindowTransform * /*transform*/, size_t /*function_index*/, T /*value*/) { - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "setValueToOutputColumn() is not implemented for {} type", typeid(T).name()); + throw Exception(ErrorCodes::NOT_IMPLEMENTED, "recurrent_detail::setValueToOutputColumn() is not implemented for {} type", typeid(T).name()); } template<> void setValueToOutputColumn(const WindowTransform * transform, size_t function_index, Float64 value) @@ -1607,82 +1566,73 @@ namespace recurrent_detail assert_cast(to).getData().push_back(value); } +} - template T getCurrentValueFromInputColumn(const WindowTransform * /*transform*/, size_t /*function_index*/, size_t /*column_index*/) +struct WindowFunctionHelpers +{ + template + static T getValue(const WindowTransform * transform, size_t function_index, size_t column_index, RowNumber row) { - throw Exception(ErrorCodes::NOT_IMPLEMENTED, "getCurrentValueFromInputColumn() is not implemented for {} type", typeid(T).name()); + return recurrent_detail::getValue(transform, function_index, column_index, row); } - template<> Float64 getCurrentValueFromInputColumn(const WindowTransform * transform, size_t function_index, size_t column_index) + template + static void setValueToOutputColumn(const WindowTransform * transform, size_t function_index, T value) { - const auto & workspace = transform->workspaces[function_index]; - auto current_row = transform->current_row; - const auto & current_block = transform->blockAt(current_row); - - return (*current_block.input_columns[workspace.argument_column_indices[column_index]]).getFloat64(transform->current_row.row); + recurrent_detail::setValueToOutputColumn(transform, function_index, value); } -} +}; -template -struct RecurrentWindowFunction : public WindowFunction +template +struct StatefulWindowFunction : public WindowFunction { - RecurrentWindowFunction(const std::string & name_, + StatefulWindowFunction(const std::string & name_, const DataTypes & argument_types_, const Array & parameters_) : WindowFunction(name_, argument_types_, parameters_) { } - size_t sizeOfData() const override { return sizeof(Float64)*state_size; } + size_t sizeOfData() const override { return sizeof(State); } size_t alignOfData() const override { return 1; } void create(AggregateDataPtr __restrict place) const override { - auto * const state = static_cast(static_cast(place)); - for (size_t i = 0; i < state_size; ++i) - state[i] = 0.0; - } - - template - static T getLastValueFromInputColumn(const WindowTransform * transform, size_t function_index, size_t column_index) - { - return recurrent_detail::getLastValueFromInputColumn(transform, function_index, column_index); + new (place) State(); } - template - static T getLastValueFromState(const WindowTransform * transform, size_t function_index, size_t data_index) + void destroy(AggregateDataPtr __restrict place) const noexcept override { - return recurrent_detail::getLastValueFromState(transform, function_index, data_index); + auto * const state = static_cast(static_cast(place)); + state->~State(); } - template - static void setValueToState(const WindowTransform * transform, size_t function_index, T value, size_t data_index) + State & getState(const WindowFunctionWorkspace & workspace) { - recurrent_detail::setValueToState(transform, function_index, value, data_index); + return *static_cast(static_cast(workspace.aggregate_function_state.data())); } +}; - template - static void setValueToOutputColumn(const WindowTransform * transform, size_t function_index, T value) - { - recurrent_detail::setValueToOutputColumn(transform, function_index, value); - } +struct ExponentialTimeDecayedSumState +{ + Float64 previous_time; + Float64 previous_sum; +}; - template - static T getCurrentValueFromInputColumn(const WindowTransform * transform, size_t function_index, size_t column_index) - { - return recurrent_detail::getCurrentValueFromInputColumn(transform, function_index, column_index); - } +struct ExponentialTimeDecayedAvgState +{ + Float64 previous_time; + Float64 previous_sum; + Float64 previous_count; }; -struct WindowFunctionExponentialTimeDecayedSum final : public RecurrentWindowFunction<1> +struct WindowFunctionExponentialTimeDecayedSum final : public StatefulWindowFunction { static constexpr size_t ARGUMENT_VALUE = 0; static constexpr size_t ARGUMENT_TIME = 1; - static constexpr size_t STATE_SUM = 0; - WindowFunctionExponentialTimeDecayedSum(const std::string & name_, const DataTypes & argument_types_, const Array & parameters_) - : RecurrentWindowFunction(name_, argument_types_, parameters_) + : StatefulWindowFunction(name_, argument_types_, parameters_) { if (parameters_.size() != 1) { @@ -1724,33 +1674,63 @@ struct WindowFunctionExponentialTimeDecayedSum final : public RecurrentWindowFun void windowInsertResultInto(const WindowTransform * transform, size_t function_index) override { - Float64 last_sum = getLastValueFromState(transform, function_index, STATE_SUM); - Float64 last_t = getLastValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + const auto & workspace = transform->workspaces[function_index]; + auto & state = getState(workspace); + + Float64 result = 0; + + if (transform->frame_start < transform->frame_end) + { + RowNumber frame_back = transform->prevRowNumber(transform->frame_end); + Float64 back_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, frame_back); - Float64 x = getCurrentValueFromInputColumn(transform, function_index, ARGUMENT_VALUE); - Float64 t = getCurrentValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + if (transform->prev_frame_start <= transform->frame_start + && transform->frame_start < transform->prev_frame_end + && transform->prev_frame_end <= transform->frame_end) + { + for (RowNumber i = transform->prev_frame_start; i < transform->frame_start; transform->advanceRowNumber(i)) + { + Float64 prev_val = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_VALUE, i); + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + result -= std::exp((prev_t - back_t) / decay_length) * prev_val; + } + result += std::exp((state.previous_time - back_t) / decay_length) * state.previous_sum; + for (RowNumber i = transform->prev_frame_end; i < transform->frame_end; transform->advanceRowNumber(i)) + { + Float64 prev_val = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_VALUE, i); + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + result += std::exp((prev_t - back_t) / decay_length) * prev_val; + } + } + else + { + for (RowNumber i = transform->frame_start; i < transform->frame_end; transform->advanceRowNumber(i)) + { + Float64 prev_val = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_VALUE, i); + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + result += std::exp((prev_t - back_t) / decay_length) * prev_val; + } + } - Float64 c = exp((last_t - t) / decay_length); - Float64 result = x + c * last_sum; + state.previous_sum = result; + state.previous_time = back_t; + } - setValueToOutputColumn(transform, function_index, result); - setValueToState(transform, function_index, result, STATE_SUM); + WindowFunctionHelpers::setValueToOutputColumn(transform, function_index, result); } private: Float64 decay_length; }; -struct WindowFunctionExponentialTimeDecayedMax final : public RecurrentWindowFunction<1> +struct WindowFunctionExponentialTimeDecayedMax final : public WindowFunction { static constexpr size_t ARGUMENT_VALUE = 0; static constexpr size_t ARGUMENT_TIME = 1; - static constexpr size_t STATE_MAX = 0; - WindowFunctionExponentialTimeDecayedMax(const std::string & name_, const DataTypes & argument_types_, const Array & parameters_) - : RecurrentWindowFunction(name_, argument_types_, parameters_) + : WindowFunction(name_, argument_types_, parameters_) { if (parameters_.size() != 1) { @@ -1792,32 +1772,41 @@ struct WindowFunctionExponentialTimeDecayedMax final : public RecurrentWindowFun void windowInsertResultInto(const WindowTransform * transform, size_t function_index) override { - Float64 last_max = getLastValueFromState(transform, function_index, STATE_MAX); - Float64 last_t = getLastValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + Float64 result = std::numeric_limits::quiet_NaN(); + + if (transform->frame_start < transform->frame_end) + { + result = std::numeric_limits::lowest(); + RowNumber frame_back = transform->prevRowNumber(transform->frame_end); + Float64 back_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, frame_back); - Float64 x = getCurrentValueFromInputColumn(transform, function_index, ARGUMENT_VALUE); - Float64 t = getCurrentValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + for (RowNumber i = transform->frame_start; i < transform->frame_end; transform->advanceRowNumber(i)) + { + Float64 value = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_VALUE, i); + Float64 t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); - Float64 c = exp((last_t - t) / decay_length); - Float64 result = std::max(x, c * last_max); + /// Avoiding extra calls to `exp` and multiplications. + if (value > result || t > back_t || result < 0) + { + result = std::max(std::exp((t - back_t) / decay_length) * value, result); + } + } + } - setValueToOutputColumn(transform, function_index, result); - setValueToState(transform, function_index, result, STATE_MAX); + WindowFunctionHelpers::setValueToOutputColumn(transform, function_index, result); } private: Float64 decay_length; }; -struct WindowFunctionExponentialTimeDecayedCount final : public RecurrentWindowFunction<1> +struct WindowFunctionExponentialTimeDecayedCount final : public StatefulWindowFunction { static constexpr size_t ARGUMENT_TIME = 0; - static constexpr size_t STATE_COUNT = 0; - WindowFunctionExponentialTimeDecayedCount(const std::string & name_, const DataTypes & argument_types_, const Array & parameters_) - : RecurrentWindowFunction(name_, argument_types_, parameters_) + : StatefulWindowFunction(name_, argument_types_, parameters_) { if (parameters_.size() != 1) { @@ -1851,33 +1840,60 @@ struct WindowFunctionExponentialTimeDecayedCount final : public RecurrentWindowF void windowInsertResultInto(const WindowTransform * transform, size_t function_index) override { - Float64 last_count = getLastValueFromState(transform, function_index, STATE_COUNT); - Float64 last_t = getLastValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + const auto & workspace = transform->workspaces[function_index]; + auto & state = getState(workspace); + + Float64 result = 0; - Float64 t = getCurrentValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + if (transform->frame_start < transform->frame_end) + { + RowNumber frame_back = transform->prevRowNumber(transform->frame_end); + Float64 back_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, frame_back); + + if (transform->prev_frame_start <= transform->frame_start + && transform->frame_start < transform->prev_frame_end + && transform->prev_frame_end <= transform->frame_end) + { + for (RowNumber i = transform->prev_frame_start; i < transform->frame_start; transform->advanceRowNumber(i)) + { + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + result -= std::exp((prev_t - back_t) / decay_length); + } + result += std::exp((state.previous_time - back_t) / decay_length) * state.previous_sum; + for (RowNumber i = transform->prev_frame_end; i < transform->frame_end; transform->advanceRowNumber(i)) + { + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + result += std::exp((prev_t - back_t) / decay_length); + } + } + else + { + for (RowNumber i = transform->frame_start; i < transform->frame_end; transform->advanceRowNumber(i)) + { + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + result += std::exp((prev_t - back_t) / decay_length); + } + } - Float64 c = exp((last_t - t) / decay_length); - Float64 result = c * last_count + 1.0; + state.previous_sum = result; + state.previous_time = back_t; + } - setValueToOutputColumn(transform, function_index, result); - setValueToState(transform, function_index, result, STATE_COUNT); + WindowFunctionHelpers::setValueToOutputColumn(transform, function_index, result); } private: Float64 decay_length; }; -struct WindowFunctionExponentialTimeDecayedAvg final : public RecurrentWindowFunction<2> +struct WindowFunctionExponentialTimeDecayedAvg final : public StatefulWindowFunction { static constexpr size_t ARGUMENT_VALUE = 0; static constexpr size_t ARGUMENT_TIME = 1; - static constexpr size_t STATE_SUM = 0; - static constexpr size_t STATE_COUNT = 1; - WindowFunctionExponentialTimeDecayedAvg(const std::string & name_, const DataTypes & argument_types_, const Array & parameters_) - : RecurrentWindowFunction(name_, argument_types_, parameters_) + : StatefulWindowFunction(name_, argument_types_, parameters_) { if (parameters_.size() != 1) { @@ -1919,21 +1935,66 @@ struct WindowFunctionExponentialTimeDecayedAvg final : public RecurrentWindowFun void windowInsertResultInto(const WindowTransform * transform, size_t function_index) override { - Float64 last_sum = getLastValueFromState(transform, function_index, STATE_SUM); - Float64 last_count = getLastValueFromState(transform, function_index, STATE_COUNT); - Float64 last_t = getLastValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + const auto & workspace = transform->workspaces[function_index]; + auto & state = getState(workspace); + + Float64 count = 0; + Float64 sum = 0; + Float64 result = std::numeric_limits::quiet_NaN(); + + if (transform->frame_start < transform->frame_end) + { + RowNumber frame_back = transform->prevRowNumber(transform->frame_end); + Float64 back_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, frame_back); + + if (transform->prev_frame_start <= transform->frame_start + && transform->frame_start < transform->prev_frame_end + && transform->prev_frame_end <= transform->frame_end) + { + for (RowNumber i = transform->prev_frame_start; i < transform->frame_start; transform->advanceRowNumber(i)) + { + Float64 prev_val = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_VALUE, i); + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + Float64 decay = std::exp((prev_t - back_t) / decay_length); + sum -= decay * prev_val; + count -= decay; + } + + { + Float64 decay = std::exp((state.previous_time - back_t) / decay_length); + sum += decay * state.previous_sum; + count += decay * state.previous_count; + } + + for (RowNumber i = transform->prev_frame_end; i < transform->frame_end; transform->advanceRowNumber(i)) + { + Float64 prev_val = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_VALUE, i); + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + Float64 decay = std::exp((prev_t - back_t) / decay_length); + sum += decay * prev_val; + count += decay; + } + } + else + { + for (RowNumber i = transform->frame_start; i < transform->frame_end; transform->advanceRowNumber(i)) + { + Float64 prev_val = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_VALUE, i); + Float64 prev_t = WindowFunctionHelpers::getValue(transform, function_index, ARGUMENT_TIME, i); + Float64 decay = std::exp((prev_t - back_t) / decay_length); + sum += decay * prev_val; + count += decay; + } + } - Float64 x = getCurrentValueFromInputColumn(transform, function_index, ARGUMENT_VALUE); - Float64 t = getCurrentValueFromInputColumn(transform, function_index, ARGUMENT_TIME); + state.previous_sum = sum; + state.previous_count = count; + state.previous_time = back_t; - Float64 c = exp((last_t - t) / decay_length); - Float64 new_sum = c * last_sum + x; - Float64 new_count = c * last_count + 1.0; - Float64 result = new_sum / new_count; + result = sum/count; + } - setValueToOutputColumn(transform, function_index, result); - setValueToState(transform, function_index, new_sum, STATE_SUM); - setValueToState(transform, function_index, new_count, STATE_COUNT); + WindowFunctionHelpers::setValueToOutputColumn(transform, function_index, result); } private: diff --git a/src/Processors/Transforms/WindowTransform.h b/src/Processors/Transforms/WindowTransform.h index d536c8780d2..dedc8c9941c 100644 --- a/src/Processors/Transforms/WindowTransform.h +++ b/src/Processors/Transforms/WindowTransform.h @@ -198,8 +198,19 @@ class WindowTransform final : public IProcessor ++x.block; } + RowNumber nextRowNumber(const RowNumber & x) const + { + RowNumber result = x; + advanceRowNumber(result); + return result; + } + void retreatRowNumber(RowNumber & x) const { +#ifndef NDEBUG + auto original_x = x; +#endif + if (x.row > 0) { --x.row; @@ -213,12 +224,19 @@ class WindowTransform final : public IProcessor x.row = blockAt(x).rows - 1; #ifndef NDEBUG - auto xx = x; - advanceRowNumber(xx); - assert(xx == x); + auto advanced_retreated_x = x; + advanceRowNumber(advanced_retreated_x); + assert(advanced_retreated_x == original_x); #endif } + RowNumber prevRowNumber(const RowNumber & x) const + { + RowNumber result = x; + retreatRowNumber(result); + return result; + } + auto moveRowNumber(const RowNumber & _x, int64_t offset) const; auto moveRowNumberNoCheck(const RowNumber & _x, int64_t offset) const; diff --git a/src/Processors/Transforms/buildPushingToViewsChain.cpp b/src/Processors/Transforms/buildPushingToViewsChain.cpp index 3cb5b16a2d0..0d47494d22b 100644 --- a/src/Processors/Transforms/buildPushingToViewsChain.cpp +++ b/src/Processors/Transforms/buildPushingToViewsChain.cpp @@ -237,29 +237,30 @@ Chain buildPushingToViewsChain( ASTPtr query; Chain out; - /// If the materialized view is executed outside of a query, for example as a result of SYSTEM FLUSH LOGS or - /// SYSTEM FLUSH DISTRIBUTED ..., we can't attach to any thread group and we won't log, so there is no point on collecting metrics - std::unique_ptr view_thread_status_ptr = nullptr; - - ThreadGroupStatusPtr running_group = current_thread && current_thread->getThreadGroup() - ? current_thread->getThreadGroup() - : MainThreadStatus::getInstance().getThreadGroup(); - if (running_group) + ThreadGroupStatusPtr running_group; + if (current_thread && current_thread->getThreadGroup()) + running_group = current_thread->getThreadGroup(); + else + running_group = std::make_shared(); + + /// We are creating a ThreadStatus per view to store its metrics individually + /// Since calling ThreadStatus() changes current_thread we save it and restore it after the calls + /// Later on, before doing any task related to a view, we'll switch to its ThreadStatus, do the work, + /// and switch back to the original thread_status. + auto * original_thread = current_thread; + SCOPE_EXIT({ current_thread = original_thread; }); + + std::unique_ptr view_thread_status_ptr = std::make_unique(); + /// Disable query profiler for this ThreadStatus since the running (main query) thread should already have one + /// If we didn't disable it, then we could end up with N + 1 (N = number of dependencies) profilers which means + /// N times more interruptions + view_thread_status_ptr->disableProfiling(); + /// view_thread_status_ptr will be moved later (on and on), so need to capture raw pointer. + view_thread_status_ptr->deleter = [thread_status = view_thread_status_ptr.get(), running_group] { - /// We are creating a ThreadStatus per view to store its metrics individually - /// Since calling ThreadStatus() changes current_thread we save it and restore it after the calls - /// Later on, before doing any task related to a view, we'll switch to its ThreadStatus, do the work, - /// and switch back to the original thread_status. - auto * original_thread = current_thread; - SCOPE_EXIT({ current_thread = original_thread; }); - - view_thread_status_ptr = std::make_unique(); - /// Disable query profiler for this ThreadStatus since the running (main query) thread should already have one - /// If we didn't disable it, then we could end up with N + 1 (N = number of dependencies) profilers which means - /// N times more interruptions - view_thread_status_ptr->disableProfiling(); - view_thread_status_ptr->attachQuery(running_group); - } + thread_status->detachQuery(); + }; + view_thread_status_ptr->attachQuery(running_group); auto runtime_stats = std::make_unique(); runtime_stats->target_name = database_table.getFullTableName(); diff --git a/tests/ci/ast_fuzzer_check.py b/tests/ci/ast_fuzzer_check.py index 94f5eff51d7..d3c87120789 100644 --- a/tests/ci/ast_fuzzer_check.py +++ b/tests/ci/ast_fuzzer_check.py @@ -24,7 +24,7 @@ from stopwatch import Stopwatch from rerun_helper import RerunHelper -IMAGE_NAME = "clickhouse/fuzzer" +IMAGE_NAME = "altinityinfra/fuzzer" def get_run_command(pr_number, sha, download_url, workspace_path, image): diff --git a/tests/ci/build_check.py b/tests/ci/build_check.py index 4c77f77a702..cb8d03a8355 100644 --- a/tests/ci/build_check.py +++ b/tests/ci/build_check.py @@ -8,7 +8,7 @@ import time from typing import List, Optional, Tuple -from env_helper import REPO_COPY, TEMP_PATH, CACHES_PATH, IMAGES_PATH, GITHUB_JOB +from env_helper import REPO_COPY, TEMP_PATH, CACHES_PATH, IMAGES_PATH, S3_BUILDS_BUCKET, GITHUB_JOB, CLICKHOUSE_STABLE_VERSION_SUFFIX from s3_helper import S3Helper from pr_info import PRInfo from version_helper import ( @@ -21,7 +21,7 @@ from docker_pull_helper import get_image_with_version from tee_popen import TeePopen -IMAGE_NAME = "clickhouse/binary-builder" +IMAGE_NAME = "altinityinfra/binary-builder" def get_build_config(build_check_name: str, build_name: str) -> BuildConfig: @@ -230,12 +230,12 @@ def main(): log_url = "" for url in build_results: if "build_log.log" in url: - log_url = "https://s3.amazonaws.com/clickhouse-builds/" + url.replace( + log_url = f"https://s3.amazonaws.com/{S3_BUILDS_BUCKET}/" + url.replace( "+", "%2B" ).replace(" ", "%20") else: build_urls.append( - "https://s3.amazonaws.com/clickhouse-builds/" + f"https://s3.amazonaws.com/{S3_BUILDS_BUCKET}/" + url.replace("+", "%2B").replace(" ", "%20") ) success = len(build_urls) > 0 @@ -259,15 +259,19 @@ def main(): logging.info("Got version from repo %s", version.string) - official_flag = pr_info.number == 0 - version_type = "testing" - if "release" in pr_info.labels or "release-lts" in pr_info.labels: - version_type = "stable" - official_flag = True + official_flag = True + version._flavour = version_type = CLICKHOUSE_STABLE_VERSION_SUFFIX + # TODO (vnemkov): right now we'll use simplified version management: + # only update git hash and explicitly set stable version suffix. + # official_flag = pr_info.number == 0 + # version_type = "testing" + # if "release" in pr_info.labels or "release-lts" in pr_info.labels: + # version_type = CLICKHOUSE_STABLE_VERSION_SUFFIX + # official_flag = True update_version_local(version, version_type) - logging.info("Updated local files with version") + logging.info(f"Updated local files with version : {version.string} / {version.describe}") logging.info("Build short name %s", build_name) diff --git a/tests/ci/ccache_utils.py b/tests/ci/ccache_utils.py index 7b0b0f01aa3..734818f6ec6 100644 --- a/tests/ci/ccache_utils.py +++ b/tests/ci/ccache_utils.py @@ -5,6 +5,7 @@ import sys import os import shutil +from env_helper import S3_BUILDS_BUCKET from pathlib import Path import requests @@ -71,7 +72,7 @@ def get_ccache_if_not_exists( for obj in objects: if ccache_name in obj: logging.info("Found ccache on path %s", obj) - url = "https://s3.amazonaws.com/clickhouse-builds/" + obj + url = f"https://s3.amazonaws.com/{S3_BUILDS_BUCKET}/" + obj compressed_cache = os.path.join(temp_path, os.path.basename(obj)) dowload_file_with_progress(url, compressed_cache) diff --git a/tests/ci/ci_config.py b/tests/ci/ci_config.py index 74dbe65911c..8e3f8d6a68c 100644 --- a/tests/ci/ci_config.py +++ b/tests/ci/ci_config.py @@ -188,15 +188,7 @@ }, "builds_report_config": { "ClickHouse build check (actions)": [ - "package_release", - "performance", - "package_aarch64", - "package_asan", - "package_ubsan", - "package_tsan", - "package_msan", - "package_debug", - "binary_release", + "package_release" ], "ClickHouse special build check (actions)": [ "binary_tidy", @@ -307,7 +299,7 @@ "Split build smoke test (actions)": { "required_build": "binary_splitted", }, - "Testflows check (actions)": { + "TestFlows tests (release, actions)": { "required_build": "package_release", }, "Unit tests (release-gcc, actions)": { diff --git a/tests/ci/clickhouse_helper.py b/tests/ci/clickhouse_helper.py index a81334860d1..2d4367f3913 100644 --- a/tests/ci/clickhouse_helper.py +++ b/tests/ci/clickhouse_helper.py @@ -43,6 +43,7 @@ def _insert_json_str_info_impl(url, auth, db, table, json_str): i, e, ) + error = e continue logging.info("Response content '%s'", response.content) @@ -142,7 +143,7 @@ def prepare_tests_results_for_clickhouse( check_name, ): - pull_request_url = "https://github.com/ClickHouse/ClickHouse/commits/master" + pull_request_url = "https://github.com/Altinity/ClickHouse/commits/master" base_ref = "master" head_ref = "master" base_repo = pr_info.repo_full_name @@ -201,7 +202,7 @@ def mark_flaky_tests(clickhouse_helper, check_name, test_results): AND pull_request_number = 0 """ - tests_data = clickhouse_helper.select_json_each_row("default", query) + tests_data = clickhouse_helper.select_json_each_row("gh-data", query) master_failed_tests = {row["test_name"] for row in tests_data} logging.info("Found flaky tests: %s", ", ".join(master_failed_tests)) diff --git a/tests/ci/codebrowser_check.py b/tests/ci/codebrowser_check.py index 48c92e9f6ac..3a245005cb4 100644 --- a/tests/ci/codebrowser_check.py +++ b/tests/ci/codebrowser_check.py @@ -40,7 +40,7 @@ def get_run_command(repo_path, output_path, image): if not os.path.exists(temp_path): os.makedirs(temp_path) - docker_image = get_image_with_version(IMAGES_PATH, "clickhouse/codebrowser") + docker_image = get_image_with_version(IMAGES_PATH, "altinityinfra/codebrowser") s3_helper = S3Helper("https://s3.amazonaws.com") result_path = os.path.join(temp_path, "result_path") diff --git a/tests/ci/compatibility_check.py b/tests/ci/compatibility_check.py index a6846257cce..2351ef0c60a 100644 --- a/tests/ci/compatibility_check.py +++ b/tests/ci/compatibility_check.py @@ -24,8 +24,8 @@ from stopwatch import Stopwatch from rerun_helper import RerunHelper -IMAGE_UBUNTU = "clickhouse/test-old-ubuntu" -IMAGE_CENTOS = "clickhouse/test-old-centos" +IMAGE_UBUNTU = "altinityinfra/test-old-ubuntu" +IMAGE_CENTOS = "altinityinfra/test-old-centos" MAX_GLIBC_VERSION = "2.4" DOWNLOAD_RETRIES_COUNT = 5 CHECK_NAME = "Compatibility check (actions)" @@ -197,4 +197,8 @@ def url_filter(url): report_url, CHECK_NAME, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + if state == "error": + sys.exit(1) diff --git a/tests/ci/docker_images_check.py b/tests/ci/docker_images_check.py index 2e181f678dd..9d5173648e3 100644 --- a/tests/ci/docker_images_check.py +++ b/tests/ci/docker_images_check.py @@ -106,22 +106,23 @@ def get_changed_docker_images( str(files_changed), ) - changed_images = [] - - for dockerfile_dir, image_description in images_dict.items(): - for f in files_changed: - if f.startswith(dockerfile_dir): - name = image_description["name"] - only_amd64 = image_description.get("only_amd64", False) - logging.info( - "Found changed file '%s' which affects " - "docker image '%s' with path '%s'", - f, - name, - dockerfile_dir, - ) - changed_images.append(DockerImage(dockerfile_dir, name, only_amd64)) - break + # Rebuild all images + changed_images = [DockerImage(dockerfile_dir, image_description["name"], image_description.get("only_amd64", False)) for dockerfile_dir, image_description in images_dict.items()] + + # for dockerfile_dir, image_description in images_dict.items(): + # for f in files_changed: + # if f.startswith(dockerfile_dir): + # name = image_description["name"] + # only_amd64 = image_description.get("only_amd64", False) + # logging.info( + # "Found changed file '%s' which affects " + # "docker image '%s' with path '%s'", + # f, + # name, + # dockerfile_dir, + # ) + # changed_images.append(DockerImage(dockerfile_dir, name, only_amd64)) + # break # The order is important: dependents should go later than bases, so that # they are built with updated base versions. @@ -253,6 +254,19 @@ def build_and_push_one_image( f"--tag {image.repo}:{version_string} " f"{cache_from} " f"--cache-to type=inline,mode=max " + # FIXME: many tests utilize packages without specifying version, hence docker pulls :latest + # this will fail multiple jobs are going to be executed on different machines and + # push different images as latest. + # To fix it we may: + # - require jobs to be executed on same machine images were built (no parallelism) + # - change all the test's code (mostly docker-compose files in integration tests) + # that depend on said images and push version somehow into docker-compose. + # (and that is lots of work and many potential conflicts with upstream) + # - tag and push all images as :latest and then just pray that collisions are infrequent. + # and if even if collision happens, image is not that different and would still properly work. + # (^^^ CURRENT SOLUTION ^^^) But this is just a numbers game, it will blow up at some point. + # - do something crazy + f"--tag {image.repo}:latest " f"{push_arg}" f"--progress plain {image.full_path}" ) @@ -261,6 +275,7 @@ def build_and_push_one_image( retcode = proc.wait() if retcode != 0: + logging.error("Building image {} failed with error: {}\n{}".format(image, retcode, ''.join(list(open(build_log, 'rt'))))) return False, build_log logging.info("Processing of %s successfully finished", image.repo) @@ -407,8 +422,8 @@ def main(): if args.push: subprocess.check_output( # pylint: disable=unexpected-keyword-arg - "docker login --username 'robotclickhouse' --password-stdin", - input=get_parameter_from_ssm("dockerhub_robot_password"), + "docker login --username 'altinityinfra' --password-stdin", + input=get_parameter_from_ssm("dockerhub-password"), encoding="utf-8", shell=True, ) @@ -490,7 +505,7 @@ def main(): NAME, ) ch_helper = ClickHouseHelper() - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) if status == "error": sys.exit(1) diff --git a/tests/ci/docker_manifests_merge.py b/tests/ci/docker_manifests_merge.py index 9371440346e..0d061bb0db3 100644 --- a/tests/ci/docker_manifests_merge.py +++ b/tests/ci/docker_manifests_merge.py @@ -173,8 +173,8 @@ def main(): args = parse_args() if args.push: subprocess.check_output( # pylint: disable=unexpected-keyword-arg - "docker login --username 'robotclickhouse' --password-stdin", - input=get_parameter_from_ssm("dockerhub_robot_password"), + "docker login --username 'altinityinfra' --password-stdin", + input=get_parameter_from_ssm("dockerhub-password"), encoding="utf-8", shell=True, ) @@ -234,7 +234,7 @@ def main(): NAME, ) ch_helper = ClickHouseHelper() - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) if __name__ == "__main__": diff --git a/tests/ci/docker_pull_helper.py b/tests/ci/docker_pull_helper.py index 54d48c58805..2a7e5a219cd 100644 --- a/tests/ci/docker_pull_helper.py +++ b/tests/ci/docker_pull_helper.py @@ -5,6 +5,8 @@ import time import subprocess import logging +import traceback +import platform class DockerImage: @@ -42,12 +44,13 @@ def get_images_with_versions(reports_path, required_image, pull=True): docker_images = [] for image_name in required_image: - docker_image = DockerImage(image_name) + docker_image = image_name if isinstance(image_name, DockerImage) else DockerImage(image_name) if image_name in images: docker_image.version = images[image_name] docker_images.append(docker_image) if pull: + latest_error = None for docker_image in docker_images: for i in range(10): try: @@ -60,7 +63,17 @@ def get_images_with_versions(reports_path, required_image, pull=True): break except Exception as ex: time.sleep(i * 3) - logging.info("Got execption pulling docker %s", ex) + logging.info("Got exception pulling docker %s", ex) + latest_error = traceback.format_exc() + + # TODO (vnemkov): remove once we have a docker proxy set up. + # Upstream uses some sort of proxy that routes plain images to amd64/aarch64 variants, + # here we do the same manually. + machine_arch = {'x86_64': 'amd64'}[platform.machine().lower()] + if not docker_image.version.endswith(machine_arch): + docker_image.version = f'{docker_image.version}-{machine_arch}' + logging.debug('Trying to fetch machine-specific docker image as %s', docker_image) + else: raise Exception( f"Cannot pull dockerhub for image docker pull {docker_image} because of {latest_error}" @@ -71,3 +84,19 @@ def get_images_with_versions(reports_path, required_image, pull=True): def get_image_with_version(reports_path, image, pull=True): return get_images_with_versions(reports_path, [image], pull)[0] + +def docker_image(name): + s = name.split(':') + return DockerImage(s[0], s[1] if len(s) > 1 else None) + +if __name__ == "__main__": + logging.basicConfig(level=logging.DEBUG) + def parse_args(): + import argparse + arg_parser = argparse.ArgumentParser() + arg_parser.add_argument('--image', type=docker_image, nargs='+') + arg_parser.add_argument('--pull', type=bool, default=True) + return arg_parser.parse_args() + + args = parse_args() + get_images_with_versions('.', args.image, args.pull) diff --git a/tests/ci/docker_server.py b/tests/ci/docker_server.py index 4fbb1faee04..83c4a0089cd 100644 --- a/tests/ci/docker_server.py +++ b/tests/ci/docker_server.py @@ -71,7 +71,7 @@ def parse_args() -> argparse.Namespace: parser.add_argument( "--image-repo", type=str, - default="clickhouse/clickhouse-server", + default="altinityinfra/clickhouse-server", help="image name on docker hub", ) parser.add_argument( @@ -308,8 +308,8 @@ def main(): if args.push: subprocess.check_output( # pylint: disable=unexpected-keyword-arg - "docker login --username 'robotclickhouse' --password-stdin", - input=get_parameter_from_ssm("dockerhub_robot_password"), + "docker login --username 'altinityinfra' --password-stdin", + input=get_parameter_from_ssm("dockerhub-password"), encoding="utf-8", shell=True, ) @@ -357,7 +357,7 @@ def main(): NAME, ) ch_helper = ClickHouseHelper() - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) if __name__ == "__main__": diff --git a/tests/ci/docker_test.py b/tests/ci/docker_test.py index 32df6d5f1d0..95ac61a0c1e 100644 --- a/tests/ci/docker_test.py +++ b/tests/ci/docker_test.py @@ -37,61 +37,61 @@ def test_get_changed_docker_images(self): self.maxDiff = None expected = sorted( [ - di.DockerImage("docker/test/base", "clickhouse/test-base", False), - di.DockerImage("docker/docs/builder", "clickhouse/docs-builder", True), + di.DockerImage("docker/test/base", "altinityinfra/test-base", False), + di.DockerImage("docker/docs/builder", "altinityinfra/docs-builder", True), di.DockerImage( "docker/test/stateless", - "clickhouse/stateless-test", + "altinityinfra/stateless-test", False, - "clickhouse/test-base", + "altinityinfra/test-base", ), di.DockerImage( "docker/test/integration/base", - "clickhouse/integration-test", + "altinityinfra/integration-test", False, - "clickhouse/test-base", - ), - di.DockerImage( - "docker/test/fuzzer", - "clickhouse/fuzzer", - False, - "clickhouse/test-base", + "altinityinfra/test-base", ), + # di.DockerImage( + # "docker/test/fuzzer", + # "altinityinfra/fuzzer", + # False, + # "altinityinfra/test-base", + # ), di.DockerImage( "docker/test/keeper-jepsen", - "clickhouse/keeper-jepsen-test", - False, - "clickhouse/test-base", - ), - di.DockerImage( - "docker/docs/check", - "clickhouse/docs-check", - False, - "clickhouse/docs-builder", - ), - di.DockerImage( - "docker/docs/release", - "clickhouse/docs-release", + "altinityinfra/keeper-jepsen-test", False, - "clickhouse/docs-builder", + "altinityinfra/test-base", ), + # di.DockerImage( + # "docker/docs/check", + # "altinityinfra/docs-check", + # False, + # "altinityinfra/docs-builder", + # ), + # di.DockerImage( + # "docker/docs/release", + # "altinityinfra/docs-release", + # False, + # "altinityinfra/docs-builder", + # ), di.DockerImage( "docker/test/stateful", - "clickhouse/stateful-test", + "altinityinfra/stateful-test", False, - "clickhouse/stateless-test", + "altinityinfra/stateless-test", ), di.DockerImage( "docker/test/unit", - "clickhouse/unit-test", + "altinityinfra/unit-test", False, - "clickhouse/stateless-test", + "altinityinfra/stateless-test", ), di.DockerImage( "docker/test/stress", - "clickhouse/stress-test", + "altinityinfra/stress-test", False, - "clickhouse/stateful-test", + "altinityinfra/stateful-test", ), ] ) diff --git a/tests/ci/docs_check.py b/tests/ci/docs_check.py index a7de66859e2..3db94bfce04 100644 --- a/tests/ci/docs_check.py +++ b/tests/ci/docs_check.py @@ -50,7 +50,7 @@ if not os.path.exists(temp_path): os.makedirs(temp_path) - docker_image = get_image_with_version(temp_path, "clickhouse/docs-check") + docker_image = get_image_with_version(temp_path, "altinityinfra/docs-check") test_output = os.path.join(temp_path, "docs_check_log") if not os.path.exists(test_output): @@ -114,4 +114,8 @@ report_url, NAME, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + if status == "error": + sys.exit(1) diff --git a/tests/ci/docs_release.py b/tests/ci/docs_release.py index b6d47326f9b..99ee9e0910d 100644 --- a/tests/ci/docs_release.py +++ b/tests/ci/docs_release.py @@ -34,7 +34,7 @@ if not os.path.exists(temp_path): os.makedirs(temp_path) - docker_image = get_image_with_version(temp_path, "clickhouse/docs-release") + docker_image = get_image_with_version(temp_path, "altinityinfra/docs-release") test_output = os.path.join(temp_path, "docs_release_log") if not os.path.exists(test_output): diff --git a/tests/ci/env_helper.py b/tests/ci/env_helper.py index dd081523db1..d2ef7f397a2 100644 --- a/tests/ci/env_helper.py +++ b/tests/ci/env_helper.py @@ -11,7 +11,7 @@ CLOUDFLARE_TOKEN = os.getenv("CLOUDFLARE_TOKEN") GITHUB_EVENT_PATH = os.getenv("GITHUB_EVENT_PATH", "") GITHUB_JOB = os.getenv("GITHUB_JOB", "local") -GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY", "ClickHouse/ClickHouse") +GITHUB_REPOSITORY = os.getenv("GITHUB_REPOSITORY", "Altinity/ClickHouse") GITHUB_RUN_ID = os.getenv("GITHUB_RUN_ID", "0") GITHUB_SERVER_URL = os.getenv("GITHUB_SERVER_URL", "https://github.com") GITHUB_WORKSPACE = os.getenv("GITHUB_WORKSPACE", git_root) @@ -20,5 +20,6 @@ REPORTS_PATH = os.getenv("REPORTS_PATH", p.abspath(p.join(module_dir, "./reports"))) REPO_COPY = os.getenv("REPO_COPY", git_root) RUNNER_TEMP = os.getenv("RUNNER_TEMP", p.abspath(p.join(module_dir, "./tmp"))) -S3_BUILDS_BUCKET = os.getenv("S3_BUILDS_BUCKET", "clickhouse-builds") -S3_TEST_REPORTS_BUCKET = os.getenv("S3_TEST_REPORTS_BUCKET", "clickhouse-test-reports") +S3_BUILDS_BUCKET = os.getenv("S3_BUILDS_BUCKET", "altinity-build-artifacts") +S3_TEST_REPORTS_BUCKET = os.getenv("S3_TEST_REPORTS_BUCKET", "altinity-build-artifacts") +CLICKHOUSE_STABLE_VERSION_SUFFIX = os.getenv("CLICKHOUSE_STABLE_VERSION_SUFFIX", "stable") diff --git a/tests/ci/fast_test_check.py b/tests/ci/fast_test_check.py index 8c17c15b463..df5464a7dac 100644 --- a/tests/ci/fast_test_check.py +++ b/tests/ci/fast_test_check.py @@ -98,7 +98,7 @@ def process_results(result_folder): logging.info("Check is already finished according to github status, exiting") sys.exit(0) - docker_image = get_image_with_version(temp_path, "clickhouse/fasttest") + docker_image = get_image_with_version(temp_path, "altinityinfra/fasttest") s3_helper = S3Helper("https://s3.amazonaws.com") @@ -204,11 +204,11 @@ def process_results(result_folder): report_url, NAME, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) # Refuse other checks to run if fast test failed if state != "success": - if "force-tests" in pr_info.labels: + if "force-tests" in pr_info.labels and state != "error": print("'force-tests' enabled, will report success") else: sys.exit(1) diff --git a/tests/ci/functional_test_check.py b/tests/ci/functional_test_check.py index cf357b11364..2b8a52b4db4 100644 --- a/tests/ci/functional_test_check.py +++ b/tests/ci/functional_test_check.py @@ -48,9 +48,9 @@ def get_additional_envs(check_name, run_by_hash_num, run_by_hash_total): def get_image_name(check_name): if "stateless" in check_name.lower(): - return "clickhouse/stateless-test" + return "altinityinfra/stateless-test" if "stateful" in check_name.lower(): - return "clickhouse/stateful-test" + return "altinityinfra/stateful-test" else: raise Exception(f"Cannot deduce image name based on check name {check_name}") @@ -190,10 +190,12 @@ def process_results(result_folder, server_log_path): run_by_hash_total = 0 check_name_with_group = check_name - rerun_helper = RerunHelper(gh, pr_info, check_name_with_group) - if rerun_helper.is_already_finished_by_status(): - logging.info("Check is already finished according to github status, exiting") - sys.exit(0) + # Always re-run, even if it finished in previous run. + # gh = Github(get_best_robot_token()) + # rerun_helper = RerunHelper(gh, pr_info, check_name_with_group) + # if rerun_helper.is_already_finished_by_status(): + # logging.info("Check is already finished according to github status, exiting") + # sys.exit(0) if not os.path.exists(temp_path): os.makedirs(temp_path) @@ -289,7 +291,7 @@ def process_results(result_folder, server_log_path): report_url, check_name_with_group, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) if state != "success": if "force-tests" in pr_info.labels: diff --git a/tests/ci/get_robot_token.py b/tests/ci/get_robot_token.py index cb79d9ae01a..10d742083f5 100644 --- a/tests/ci/get_robot_token.py +++ b/tests/ci/get_robot_token.py @@ -9,7 +9,14 @@ def get_parameter_from_ssm(name, decrypt=True, client=None): return client.get_parameter(Name=name, WithDecryption=decrypt)["Parameter"]["Value"] -def get_best_robot_token(token_prefix_env_name="github_robot_token_", total_tokens=4): +# Original CI code uses the "_original" version of this method. Each robot token is rate limited +# and the original implementation selects the "best one". To make it simpler and iterate faster, +# we are using only one robot and keeping the method signature. In the future we might reconsider +# having multiple robot tokens +def get_best_robot_token(token_prefix_env_name="github_robot_token", total_tokens=4): + return get_parameter_from_ssm(token_prefix_env_name) + +def get_best_robot_token_original(token_prefix_env_name="github_robot_token_", total_tokens=4): client = boto3.client("ssm", region_name="us-east-1") tokens = {} for i in range(1, total_tokens + 1): diff --git a/tests/ci/git_helper.py b/tests/ci/git_helper.py index 50414ffb470..18d0cbf3840 100644 --- a/tests/ci/git_helper.py +++ b/tests/ci/git_helper.py @@ -9,7 +9,7 @@ # \A and \Z match only start and end of the whole string RELEASE_BRANCH_REGEXP = r"\A\d+[.]\d+\Z" TAG_REGEXP = ( - r"\Av\d{2}[.][1-9]\d*[.][1-9]\d*[.][1-9]\d*-(testing|prestable|stable|lts)\Z" + r"\Av\d{2}[.][1-9]\d*[.][1-9]\d*[.][1-9]\d*-(testing|prestable|stable|lts|altinitystable)\Z" ) SHA_REGEXP = r"\A([0-9]|[a-f]){40}\Z" diff --git a/tests/ci/git_test.py b/tests/ci/git_test.py index 785c9b62cce..69371af40b3 100644 --- a/tests/ci/git_test.py +++ b/tests/ci/git_test.py @@ -57,6 +57,9 @@ def test_tags(self): with self.assertRaises(Exception): setattr(self.git, tag_attr, tag) + def check_tag(self): + self.git.check_tag("v21.12.333.4567-altinitystable") + def test_tweak(self): self.git.commits_since_tag = 0 self.assertEqual(self.git.tweak, 1) @@ -66,3 +69,6 @@ def test_tweak(self): self.assertEqual(self.git.tweak, 22224) self.git.commits_since_tag = 0 self.assertEqual(self.git.tweak, 22222) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/ci/integration_test_check.py b/tests/ci/integration_test_check.py index ce3173a60ce..24d5eda5477 100644 --- a/tests/ci/integration_test_check.py +++ b/tests/ci/integration_test_check.py @@ -30,17 +30,17 @@ # When update, update # integration/ci-runner.py:ClickhouseIntegrationTestsRunner.get_images_names too IMAGES = [ - "clickhouse/integration-tests-runner", - "clickhouse/mysql-golang-client", - "clickhouse/mysql-java-client", - "clickhouse/mysql-js-client", - "clickhouse/mysql-php-client", - "clickhouse/postgresql-java-client", - "clickhouse/integration-test", - "clickhouse/kerberos-kdc", - "clickhouse/kerberized-hadoop", - "clickhouse/integration-helper", - "clickhouse/dotnet-client", + "altinityinfra/integration-tests-runner", + "altinityinfra/mysql-golang-client", + "altinityinfra/mysql-java-client", + "altinityinfra/mysql-js-client", + "altinityinfra/mysql-php-client", + "altinityinfra/postgresql-java-client", + "altinityinfra/integration-test", + "altinityinfra/kerberos-kdc", + "altinityinfra/kerberized-hadoop", + "altinityinfra/integration-helper", + "altinityinfra/dotnet-client", ] @@ -146,10 +146,12 @@ def process_results(result_folder): gh = Github(get_best_robot_token()) - rerun_helper = RerunHelper(gh, pr_info, check_name_with_group) - if rerun_helper.is_already_finished_by_status(): - logging.info("Check is already finished according to github status, exiting") - sys.exit(0) + # Always re-run, even if it finished in previous run. + # gh = Github(get_best_robot_token()) + # rerun_helper = RerunHelper(gh, pr_info, check_name_with_group) + # if rerun_helper.is_already_finished_by_status(): + # logging.info("Check is already finished according to github status, exiting") + # sys.exit(0) images = get_images_with_versions(reports_path, IMAGES) images_with_versions = {i.name: i.version for i in images} @@ -233,4 +235,8 @@ def process_results(result_folder): report_url, check_name_with_group, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + if state == "error": + sys.exit(1) diff --git a/tests/ci/keeper_jepsen_check.py b/tests/ci/keeper_jepsen_check.py index 3d658e97595..98af355ab6d 100644 --- a/tests/ci/keeper_jepsen_check.py +++ b/tests/ci/keeper_jepsen_check.py @@ -26,7 +26,7 @@ JEPSEN_GROUP_NAME = "jepsen_group" DESIRED_INSTANCE_COUNT = 3 -IMAGE_NAME = "clickhouse/keeper-jepsen-test" +IMAGE_NAME = "altinityinfra/keeper-jepsen-test" CHECK_NAME = "ClickHouse Keeper Jepsen (actions)" @@ -273,5 +273,5 @@ def get_run_command( report_url, CHECK_NAME, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) clear_autoscaling_group() diff --git a/tests/ci/performance_comparison_check.py b/tests/ci/performance_comparison_check.py index c6ce86b2ce1..bd0ca267ddd 100644 --- a/tests/ci/performance_comparison_check.py +++ b/tests/ci/performance_comparison_check.py @@ -20,7 +20,7 @@ from tee_popen import TeePopen from rerun_helper import RerunHelper -IMAGE_NAME = "clickhouse/performance-comparison" +IMAGE_NAME = "altinityinfra/performance-comparison" def get_run_command( @@ -217,3 +217,6 @@ def __exit__(self, exc_type, exc_val, exc_tb): post_commit_status( gh, pr_info.sha, check_name_with_group, message, status, report_url ) + + if status == "error": + sys.exit(1) diff --git a/tests/ci/release.py b/tests/ci/release.py index 89182dc7428..2fdd4c8b174 100755 --- a/tests/ci/release.py +++ b/tests/ci/release.py @@ -400,7 +400,7 @@ def parse_args() -> argparse.Namespace: ) parser.add_argument( "--repo", - default="ClickHouse/ClickHouse", + default="Altinity/ClickHouse", help="repository to create the release", ) parser.add_argument( diff --git a/tests/ci/run_check.py b/tests/ci/run_check.py index 9c7ba13f8e4..ef96dc03e18 100644 --- a/tests/ci/run_check.py +++ b/tests/ci/run_check.py @@ -78,6 +78,7 @@ "ilejn", # Arenadata, responsible for Kerberized Kafka "thomoco", # ClickHouse "BoloniniD", # Seasoned contributor, HSE + "arthurpassos" # Altinity ] } diff --git a/tests/ci/split_build_smoke_check.py b/tests/ci/split_build_smoke_check.py index f281bdc55a8..39561a31187 100644 --- a/tests/ci/split_build_smoke_check.py +++ b/tests/ci/split_build_smoke_check.py @@ -20,7 +20,7 @@ from rerun_helper import RerunHelper -DOCKER_IMAGE = "clickhouse/split-build-smoke-test" +DOCKER_IMAGE = "altinityinfra/split-build-smoke-test" DOWNLOAD_RETRIES_COUNT = 5 RESULT_LOG_NAME = "run.log" CHECK_NAME = "Split build smoke test (actions)" @@ -147,4 +147,8 @@ def get_run_command(build_path, result_folder, server_log_folder, docker_image): report_url, CHECK_NAME, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + if state == "error": + sys.exit(1) diff --git a/tests/ci/stress_check.py b/tests/ci/stress_check.py index 3abefe3b6d7..7c110daf03e 100644 --- a/tests/ci/stress_check.py +++ b/tests/ci/stress_check.py @@ -114,7 +114,7 @@ def process_results(result_folder, server_log_path, run_log_path): logging.info("Check is already finished according to github status, exiting") sys.exit(0) - docker_image = get_image_with_version(reports_path, "clickhouse/stress-test") + docker_image = get_image_with_version(reports_path, "altinityinfra/stress-test") packages_path = os.path.join(temp_path, "packages") if not os.path.exists(packages_path): @@ -174,4 +174,7 @@ def process_results(result_folder, server_log_path, run_log_path): report_url, check_name, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + if state == "error": + sys.exit(1) diff --git a/tests/ci/style_check.py b/tests/ci/style_check.py index 4c210f9beab..2260c4d7f92 100644 --- a/tests/ci/style_check.py +++ b/tests/ci/style_check.py @@ -83,7 +83,7 @@ def process_result(result_folder): if not os.path.exists(temp_path): os.makedirs(temp_path) - docker_image = get_image_with_version(temp_path, "clickhouse/style-test") + docker_image = get_image_with_version(temp_path, "altinityinfra/style-test") s3_helper = S3Helper("https://s3.amazonaws.com") cmd = ( @@ -117,4 +117,7 @@ def process_result(result_folder): report_url, NAME, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + if state == "error": + sys.exit(1) diff --git a/tests/ci/testflows_test_check.py b/tests/ci/testflows_test_check.py new file mode 100644 index 00000000000..6e0ef96d60e --- /dev/null +++ b/tests/ci/testflows_test_check.py @@ -0,0 +1,187 @@ +#!/usr/bin/env python3 + +import os +import logging +import sys +import json +import subprocess +import csv + +from github import Github + +from env_helper import TEMP_PATH, REPO_COPY, REPORTS_PATH +from s3_helper import S3Helper +from get_robot_token import get_best_robot_token +from pr_info import PRInfo +from build_download_helper import download_all_deb_packages +from upload_result_helper import upload_results +from docker_pull_helper import get_images_with_versions +from commit_status_helper import post_commit_status +from clickhouse_helper import ( + ClickHouseHelper, + mark_flaky_tests, + prepare_tests_results_for_clickhouse, +) +from stopwatch import Stopwatch +from rerun_helper import RerunHelper +from tee_popen import TeePopen + +# When update, update +# testflows/ci-runner.py:ClickhouseTestFlowsTestsRunner.get_images_names too +IMAGES = [ + "altinityinfra/testflows-runner", +] + + +def get_json_params_dict(check_name, pr_info, docker_images): + return { + "context_name": check_name, + "commit": pr_info.sha, + "pull_request": pr_info.number, + "pr_info": {"changed_files": list(pr_info.changed_files)}, + "docker_images_with_versions": docker_images, + } + + +def get_env_for_runner(build_path, repo_path, result_path, work_path): + binary_path = os.path.join(build_path, "clickhouse") + odbc_bridge_path = os.path.join(build_path, "clickhouse-odbc-bridge") + library_bridge_path = os.path.join(build_path, "clickhouse-library-bridge") + + my_env = os.environ.copy() + my_env["CLICKHOUSE_TESTS_BUILD_PATH"] = build_path + my_env["CLICKHOUSE_TESTS_SERVER_BIN_PATH"] = binary_path + my_env["CLICKHOUSE_TESTS_CLIENT_BIN_PATH"] = binary_path + my_env["CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH"] = odbc_bridge_path + my_env["CLICKHOUSE_TESTS_LIBRARY_BRIDGE_BIN_PATH"] = library_bridge_path + my_env["CLICKHOUSE_TESTS_REPO_PATH"] = repo_path + my_env["CLICKHOUSE_TESTS_RESULT_PATH"] = result_path + my_env["CLICKHOUSE_TESTS_BASE_CONFIG_DIR"] = f"{repo_path}/programs/server" + my_env["CLICKHOUSE_TESTS_JSON_PARAMS_PATH"] = os.path.join(work_path, "params.json") + my_env["CLICKHOUSE_TESTS_RUNNER_RESTART_DOCKER"] = "0" + + return my_env + + +def process_results(result_folder): + test_results = [] + additional_files = [] + # Just upload all files from result_folder. + # If task provides processed results, then it's responsible for content of result_folder. + if os.path.exists(result_folder): + test_files = [ + f + for f in os.listdir(result_folder) + if os.path.isfile(os.path.join(result_folder, f)) + ] + additional_files = [os.path.join(result_folder, f) for f in test_files] + + status = [] + status_path = os.path.join(result_folder, "check_status.tsv") + if os.path.exists(status_path): + logging.info("Found check_status.tsv") + with open(status_path, "r", encoding="utf-8") as status_file: + status = list(csv.reader(status_file, delimiter="\t")) + + if len(status) != 1 or len(status[0]) != 2: + logging.info("Files in result folder %s", os.listdir(result_folder)) + return "error", "Invalid check_status.tsv", test_results, additional_files + state, description = status[0][0], status[0][1] + + results_path = os.path.join(result_folder, "test_results.tsv") + if os.path.exists(results_path): + logging.info("Found test_results.tsv") + with open(results_path, "r", encoding="utf-8") as results_file: + test_results = list(csv.reader(results_file, delimiter="\t")) + if len(test_results) == 0: + return "error", "Empty test_results.tsv", test_results, additional_files + + return state, description, test_results, additional_files + + +if __name__ == "__main__": + logging.basicConfig(level=logging.INFO) + + stopwatch = Stopwatch() + + temp_path = TEMP_PATH + repo_path = REPO_COPY + reports_path = REPORTS_PATH + + check_name = sys.argv[1] + + pr_info = PRInfo(need_changed_files=False) + + gh = Github(get_best_robot_token()) + + rerun_helper = RerunHelper(gh, pr_info, check_name) + if rerun_helper.is_already_finished_by_status(): + logging.info("Check is already finished according to github status, exiting") + sys.exit(0) + + images = get_images_with_versions(reports_path, IMAGES) + images_with_versions = {i.name: i.version for i in images} + result_path = os.path.join(temp_path, "output_dir") + if not os.path.exists(result_path): + os.makedirs(result_path) + + work_path = os.path.join(temp_path, "workdir") + if not os.path.exists(work_path): + os.makedirs(work_path) + + build_path = os.path.join(temp_path, "build") + if not os.path.exists(build_path): + os.makedirs(build_path) + + download_all_deb_packages(check_name, reports_path, build_path) + + my_env = get_env_for_runner(build_path, repo_path, result_path, work_path) + + json_path = os.path.join(work_path, "params.json") + with open(json_path, "w", encoding="utf-8") as json_params: + json_params.write( + json.dumps(get_json_params_dict(check_name, pr_info, images_with_versions)) + ) + + output_path_log = os.path.join(result_path, "main_script_log.txt") + + runner_path = os.path.join(repo_path, "tests/testflows", "ci-runner.py") + run_command = f"sudo -E {runner_path} | tee {output_path_log}" + + with TeePopen(run_command, output_path_log, my_env) as process: + retcode = process.wait() + if retcode == 0: + logging.info("Run tests successfully") + else: + logging.info("Some tests failed") + + subprocess.check_call(f"sudo chown -R ubuntu:ubuntu {temp_path}", shell=True) + + state, description, test_results, additional_logs = process_results(result_path) + + ch_helper = ClickHouseHelper() + mark_flaky_tests(ch_helper, check_name, test_results) + + s3_helper = S3Helper("https://s3.amazonaws.com") + report_url = upload_results( + s3_helper, + pr_info.number, + pr_info.sha, + test_results, + [output_path_log] + additional_logs, + check_name, + False, + ) + print(f"::notice ::Report url: {report_url}") + post_commit_status(gh, pr_info.sha, check_name, description, state, report_url) + + prepared_events = prepare_tests_results_for_clickhouse( + pr_info, + test_results, + state, + stopwatch.duration_seconds, + stopwatch.start_time_str, + report_url, + check_name, + ) + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) diff --git a/tests/ci/tests/docker_images.json b/tests/ci/tests/docker_images.json index ca5c516bccb..53ad258f6ec 100644 --- a/tests/ci/tests/docker_images.json +++ b/tests/ci/tests/docker_images.json @@ -1,10 +1,10 @@ { "docker/packager/deb": { - "name": "clickhouse/deb-builder", + "name": "altinityinfra/deb-builder", "dependent": [] }, "docker/packager/binary": { - "name": "clickhouse/binary-builder", + "name": "altinityinfra/binary-builder", "dependent": [ "docker/test/split_build_smoke_test", "docker/test/pvs", @@ -12,156 +12,112 @@ ] }, "docker/test/compatibility/centos": { - "name": "clickhouse/test-old-centos", + "name": "altinityinfra/test-old-centos", "dependent": [] }, "docker/test/compatibility/ubuntu": { - "name": "clickhouse/test-old-ubuntu", + "name": "altinityinfra/test-old-ubuntu", "dependent": [] }, "docker/test/integration/base": { - "name": "clickhouse/integration-test", - "dependent": [] - }, - "docker/test/fuzzer": { - "name": "clickhouse/fuzzer", - "dependent": [] - }, - "docker/test/performance-comparison": { - "name": "clickhouse/performance-comparison", - "dependent": [] - }, - "docker/test/pvs": { - "name": "clickhouse/pvs-test", + "name": "altinityinfra/integration-test", "dependent": [] }, "docker/test/util": { - "name": "clickhouse/test-util", + "name": "altinityinfra/test-util", "dependent": [ "docker/test/base", "docker/test/fasttest" ] }, "docker/test/stateless": { - "name": "clickhouse/stateless-test", + "name": "altinityinfra/stateless-test", "dependent": [ "docker/test/stateful", "docker/test/unit" ] }, "docker/test/stateful": { - "name": "clickhouse/stateful-test", + "name": "altinityinfra/stateful-test", "dependent": [ "docker/test/stress" ] }, "docker/test/unit": { - "name": "clickhouse/unit-test", - "dependent": [] - }, - "docker/test/stress": { - "name": "clickhouse/stress-test", - "dependent": [] - }, - "docker/test/split_build_smoke_test": { - "name": "clickhouse/split-build-smoke-test", - "dependent": [] - }, - "docker/test/codebrowser": { - "name": "clickhouse/codebrowser", + "name": "altinityinfra/unit-test", "dependent": [] }, "docker/test/integration/runner": { - "name": "clickhouse/integration-tests-runner", + "name": "altinityinfra/integration-tests-runner", "dependent": [] }, "docker/test/testflows/runner": { - "name": "clickhouse/testflows-runner", + "name": "altinityinfra/testflows-runner", "dependent": [] }, "docker/test/fasttest": { - "name": "clickhouse/fasttest", - "dependent": [] - }, - "docker/test/style": { - "name": "clickhouse/style-test", + "name": "altinityinfra/fasttest", "dependent": [] }, "docker/test/integration/s3_proxy": { - "name": "clickhouse/s3-proxy", + "name": "altinityinfra/s3-proxy", "dependent": [] }, "docker/test/integration/resolver": { - "name": "clickhouse/python-bottle", + "name": "altinityinfra/python-bottle", "dependent": [] }, "docker/test/integration/helper_container": { - "name": "clickhouse/integration-helper", + "name": "altinityinfra/integration-helper", "dependent": [] }, "docker/test/integration/mysql_golang_client": { - "name": "clickhouse/mysql-golang-client", + "name": "altinityinfra/mysql-golang-client", "dependent": [] }, "docker/test/integration/dotnet_client": { - "name": "clickhouse/dotnet-client", + "name": "altinityinfra/dotnet-client", "dependent": [] }, "docker/test/integration/mysql_java_client": { - "name": "clickhouse/mysql-java-client", + "name": "altinityinfra/mysql-java-client", "dependent": [] }, "docker/test/integration/mysql_js_client": { - "name": "clickhouse/mysql-js-client", + "name": "altinityinfra/mysql-js-client", "dependent": [] }, "docker/test/integration/mysql_php_client": { - "name": "clickhouse/mysql-php-client", + "name": "altinityinfra/mysql-php-client", "dependent": [] }, "docker/test/integration/postgresql_java_client": { - "name": "clickhouse/postgresql-java-client", + "name": "altinityinfra/postgresql-java-client", "dependent": [] }, "docker/test/integration/kerberos_kdc": { - "name": "clickhouse/kerberos-kdc", + "name": "altinityinfra/kerberos-kdc", "dependent": [] }, "docker/test/base": { - "name": "clickhouse/test-base", - "dependent": [ + "name": "altinityinfra/test-base", + "dependent": [ "docker/test/stateless", "docker/test/integration/base", "docker/test/fuzzer", "docker/test/keeper-jepsen" - ] + ] }, "docker/test/integration/kerberized_hadoop": { - "name": "clickhouse/kerberized-hadoop", + "name": "altinityinfra/kerberized-hadoop", "dependent": [] }, "docker/test/sqlancer": { - "name": "clickhouse/sqlancer-test", + "name": "altinityinfra/sqlancer-test", "dependent": [] }, "docker/test/keeper-jepsen": { - "name": "clickhouse/keeper-jepsen-test", - "dependent": [] - }, - "docker/docs/builder": { - "name": "clickhouse/docs-builder", - "only_amd64": true, - "dependent": [ - "docker/docs/check", - "docker/docs/release" - ] - }, - "docker/docs/check": { - "name": "clickhouse/docs-check", - "dependent": [] - }, - "docker/docs/release": { - "name": "clickhouse/docs-release", + "name": "altinityinfra/keeper-jepsen-test", "dependent": [] } } diff --git a/tests/ci/unit_tests_check.py b/tests/ci/unit_tests_check.py index 6db160d9a54..b2a1f837faa 100644 --- a/tests/ci/unit_tests_check.py +++ b/tests/ci/unit_tests_check.py @@ -25,7 +25,7 @@ from tee_popen import TeePopen -IMAGE_NAME = "clickhouse/unit-test" +IMAGE_NAME = "altinityinfra/unit-test" def get_test_name(line): @@ -173,4 +173,8 @@ def process_result(result_folder): report_url, check_name, ) - ch_helper.insert_events_into(db="default", table="checks", events=prepared_events) + + ch_helper.insert_events_into(db="gh-data", table="checks", events=prepared_events) + + if state == "error": + sys.exit(1) diff --git a/tests/ci/version_helper.py b/tests/ci/version_helper.py index 9c67191e4c3..8451b3dc428 100755 --- a/tests/ci/version_helper.py +++ b/tests/ci/version_helper.py @@ -48,6 +48,7 @@ def __init__( revision: Union[int, str], git: Git, tweak: str = None, + flavour: str = None, ): self._major = int(major) self._minor = int(minor) @@ -58,6 +59,7 @@ def __init__( if tweak is not None: self._tweak = int(tweak) self._describe = "" + self._flavour = flavour def update(self, part: str) -> "ClickHouseVersion": """If part is valid, returns a new version""" @@ -107,9 +109,12 @@ def describe(self): @property def string(self): - return ".".join( + version_as_string = ".".join( (str(self.major), str(self.minor), str(self.patch), str(self.tweak)) ) + if self._flavour: + version_as_string = f"{version_as_string}.{self._flavour}" + return version_as_string def as_dict(self) -> VERSIONS: return { @@ -129,7 +134,10 @@ def as_tuple(self) -> Tuple[int, int, int, int]: def with_description(self, version_type): if version_type not in VersionType.VALID: raise ValueError(f"version type {version_type} not in {VersionType.VALID}") - self._describe = f"v{self.string}-{version_type}" + if version_type == self._flavour: + self._describe = f"v{self.string}" + else: + self._describe = f"v{self.string}-{version_type}" def __eq__(self, other) -> bool: if not isinstance(self, type(other)): @@ -157,16 +165,16 @@ def __le__(self, other: "ClickHouseVersion") -> bool: class VersionType: LTS = "lts" PRESTABLE = "prestable" - STABLE = "stable" + STABLE = "altinitystable" TESTING = "testing" VALID = (TESTING, PRESTABLE, STABLE, LTS) def validate_version(version: str): parts = version.split(".") - if len(parts) != 4: + if len(parts) < 4: raise ValueError(f"{version} does not contain 4 parts") - for part in parts: + for part in parts[:4]: int(part) @@ -205,13 +213,16 @@ def get_version_from_repo( versions["patch"], versions["revision"], git, + # Explicitly use tweak value from version file + tweak=versions.get("tweak", versions["revision"]), + flavour=versions["flavour"] ) def get_version_from_string(version: str) -> ClickHouseVersion: validate_version(version) parts = version.split(".") - return ClickHouseVersion(parts[0], parts[1], parts[2], -1, git, parts[3]) + return ClickHouseVersion(parts[0], parts[1], parts[2], -1, git, parts[3], parts[4] if len(parts) >= 4 else None) def get_version_from_tag(tag: str) -> ClickHouseVersion: @@ -278,7 +289,7 @@ def update_contributors( cfd.write(content) -def update_version_local(version, version_type="testing"): +def update_version_local(version : ClickHouseVersion, version_type="testing"): update_contributors() version.with_description(version_type) update_cmake_version(version) diff --git a/tests/integration/ci-runner.py b/tests/integration/ci-runner.py index a301869319d..da8346f5516 100755 --- a/tests/integration/ci-runner.py +++ b/tests/integration/ci-runner.py @@ -98,6 +98,7 @@ def get_counters(fname): # Lines like: # [gw0] [ 7%] ERROR test_mysql_protocol/test.py::test_golang_client + # [gw3] [ 40%] PASSED test_replicated_users/test.py::test_rename_replicated[QUOTA] state = line_arr[-2] test_name = line_arr[-1] @@ -255,17 +256,17 @@ def shuffle_test_groups(self): @staticmethod def get_images_names(): return [ - "clickhouse/dotnet-client", - "clickhouse/integration-helper", - "clickhouse/integration-test", - "clickhouse/integration-tests-runner", - "clickhouse/kerberized-hadoop", - "clickhouse/kerberos-kdc", - "clickhouse/mysql-golang-client", - "clickhouse/mysql-java-client", - "clickhouse/mysql-js-client", - "clickhouse/mysql-php-client", - "clickhouse/postgresql-java-client", + "altinityinfra/dotnet-client", + "altinityinfra/integration-helper", + "altinityinfra/integration-test", + "altinityinfra/integration-tests-runner", + "altinityinfra/kerberized-hadoop", + "altinityinfra/kerberos-kdc", + "altinityinfra/mysql-golang-client", + "altinityinfra/mysql-java-client", + "altinityinfra/mysql-js-client", + "altinityinfra/mysql-php-client", + "altinityinfra/postgresql-java-client", ] def _can_run_with(self, path, opt): @@ -462,7 +463,7 @@ def _get_runner_image_cmd(self, repo_path): "--docker-image-version", ): for img in self.get_images_names(): - if img == "clickhouse/integration-tests-runner": + if img == "altinityinfra/integration-tests-runner": runner_version = self.get_image_version(img) logging.info( "Can run with custom docker image version %s", runner_version @@ -905,6 +906,16 @@ def run_impl(self, repo_path, build_path): if "(memory)" in self.params["context_name"]: result_state = "success" + for res in test_result: + # It's not easy to parse output of pytest + # Especially when test names may contain spaces + # Do not allow it to avoid obscure failures + if " " not in res[0]: + continue + logging.warning("Found invalid test name with space: %s", res[0]) + status_text = "Found test with invalid name, see main log" + result_state = "failure" + return result_state, status_text, test_result, [] diff --git a/tests/integration/helpers/cluster.py b/tests/integration/helpers/cluster.py index d0b5e892f5b..a32321c8dc2 100644 --- a/tests/integration/helpers/cluster.py +++ b/tests/integration/helpers/cluster.py @@ -16,21 +16,29 @@ import urllib.parse import shlex import urllib3 - -from cassandra.policies import RoundRobinPolicy -import cassandra.cluster -import psycopg2 -import pymongo -import pymysql import requests -from confluent_kafka.avro.cached_schema_registry_client import ( - CachedSchemaRegistryClient, -) + +try: + # Please, add modules that required for specific tests only here. + # So contributors will be able to run most tests locally + # without installing tons of unneeded packages that may be not so easy to install. + from cassandra.policies import RoundRobinPolicy + import cassandra.cluster + import psycopg2 + from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT + import pymongo + import pymysql + from confluent_kafka.avro.cached_schema_registry_client import ( + CachedSchemaRegistryClient, + ) + import meilisearch +except Exception as e: + logging.warning(f"Cannot import some modules, some tests may not work: {e}") + from dict2xml import dict2xml from kazoo.client import KazooClient from kazoo.exceptions import KazooException from minio import Minio -from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT from helpers.test_tools import assert_eq_with_retry, exec_query_with_retry from helpers import pytest_xdist_logging_to_separate_files @@ -689,7 +697,7 @@ def setup_keeper_cmd(self, instance, env_variables, docker_compose_yml_dir): binary_path = binary_path[: -len("-server")] env_variables["keeper_binary"] = binary_path - env_variables["image"] = "clickhouse/integration-test:" + self.docker_base_tag + env_variables["image"] = "altinityinfra/integration-test:" + self.docker_base_tag env_variables["user"] = str(os.getuid()) env_variables["keeper_fs"] = "bind" for i in range(1, 4): @@ -1169,7 +1177,7 @@ def add_instance( with_hive=False, hostname=None, env_variables=None, - image="clickhouse/integration-test", + image="altinityinfra/integration-test", tag=None, stay_alive=False, ipv4_address=None, @@ -2643,7 +2651,7 @@ def __init__( copy_common_configs=True, hostname=None, env_variables=None, - image="clickhouse/integration-test", + image="altinityinfra/integration-test", tag="latest", stay_alive=False, ipv4_address=None, diff --git a/tests/integration/helpers/network.py b/tests/integration/helpers/network.py index 63fb2065f9d..c3829e160e2 100644 --- a/tests/integration/helpers/network.py +++ b/tests/integration/helpers/network.py @@ -248,7 +248,7 @@ def _ensure_container(self): time.sleep(i) image = subprocess.check_output( - "docker images -q clickhouse/integration-helper 2>/dev/null", shell=True + "docker images -q altinityinfra/integration-helper 2>/dev/null", shell=True ) if not image.strip(): print("No network image helper, will try download") @@ -257,16 +257,16 @@ def _ensure_container(self): for i in range(5): try: subprocess.check_call( # STYLE_CHECK_ALLOW_SUBPROCESS_CHECK_CALL - "docker pull clickhouse/integration-helper", shell=True + "docker pull altinityinfra/integration-helper", shell=True ) break except: time.sleep(i) else: - raise Exception("Cannot pull clickhouse/integration-helper image") + raise Exception("Cannot pull altinityinfra/integration-helper image") self._container = self._docker_client.containers.run( - "clickhouse/integration-helper", + "altinityinfra/integration-helper", auto_remove=True, command=("sleep %s" % self.container_exit_timeout), # /run/xtables.lock passed inside for correct iptables --wait diff --git a/tests/integration/runner b/tests/integration/runner index 5a168eeea25..8666258d485 100755 --- a/tests/integration/runner +++ b/tests/integration/runner @@ -19,7 +19,7 @@ CONFIG_DIR_IN_REPO = "programs/server" INTEGRATION_DIR_IN_REPO = "tests/integration" SRC_DIR_IN_REPO = "src" -DIND_INTEGRATION_TESTS_IMAGE_NAME = "clickhouse/integration-tests-runner" +DIND_INTEGRATION_TESTS_IMAGE_NAME = "altinityinfra/integration-tests-runner" def check_args_and_update_paths(args): if args.clickhouse_root: @@ -226,23 +226,23 @@ if __name__ == "__main__": if args.docker_compose_images_tags is not None: for img_tag in args.docker_compose_images_tags: [image, tag] = img_tag.split(":") - if image == "clickhouse/mysql-golang-client": + if image == "altinityinfra/mysql-golang-client": env_tags += "-e {}={} ".format("DOCKER_MYSQL_GOLANG_CLIENT_TAG", tag) - elif image == "clickhouse/dotnet-client": + elif image == "altinityinfra/dotnet-client": env_tags += "-e {}={} ".format("DOCKER_DOTNET_CLIENT_TAG", tag) - elif image == "clickhouse/mysql-java-client": + elif image == "altinityinfra/mysql-java-client": env_tags += "-e {}={} ".format("DOCKER_MYSQL_JAVA_CLIENT_TAG", tag) - elif image == "clickhouse/mysql-js-client": + elif image == "altinityinfra/mysql-js-client": env_tags += "-e {}={} ".format("DOCKER_MYSQL_JS_CLIENT_TAG", tag) - elif image == "clickhouse/mysql-php-client": + elif image == "altinityinfra/mysql-php-client": env_tags += "-e {}={} ".format("DOCKER_MYSQL_PHP_CLIENT_TAG", tag) - elif image == "clickhouse/postgresql-java-client": + elif image == "altinityinfra/postgresql-java-client": env_tags += "-e {}={} ".format("DOCKER_POSTGRESQL_JAVA_CLIENT_TAG", tag) - elif image == "clickhouse/integration-test": + elif image == "altinityinfra/integration-test": env_tags += "-e {}={} ".format("DOCKER_BASE_TAG", tag) - elif image == "clickhouse/kerberized-hadoop": + elif image == "altinityinfra/kerberized-hadoop": env_tags += "-e {}={} ".format("DOCKER_KERBERIZED_HADOOP_TAG", tag) - elif image == "clickhouse/kerberos-kdc": + elif image == "altinityinfra/kerberos-kdc": env_tags += "-e {}={} ".format("DOCKER_KERBEROS_KDC_TAG", tag) else: logging.info("Unknown image %s" % (image)) diff --git a/tests/integration/test_merge_tree_s3/configs/config.d/storage_conf.xml b/tests/integration/test_merge_tree_s3/configs/config.d/storage_conf.xml index 2f1b8275a0b..a6e2d29c5d5 100644 --- a/tests/integration/test_merge_tree_s3/configs/config.d/storage_conf.xml +++ b/tests/integration/test_merge_tree_s3/configs/config.d/storage_conf.xml @@ -15,6 +15,13 @@ minio123 10 + + s3 + http://resolver:8082/root/data/ + minio + minio123 + 10 + local / @@ -46,6 +53,13 @@ + + +
+ no_delete_objects_s3 +
+
+
diff --git a/tests/integration/test_merge_tree_s3/s3_mocks/no_delete_objects.py b/tests/integration/test_merge_tree_s3/s3_mocks/no_delete_objects.py new file mode 100644 index 00000000000..111f3a490c2 --- /dev/null +++ b/tests/integration/test_merge_tree_s3/s3_mocks/no_delete_objects.py @@ -0,0 +1,92 @@ +import http.client +import http.server +import random +import socketserver +import sys +import urllib.parse + + +UPSTREAM_HOST = "minio1:9001" +random.seed("No delete objects/1.0") + + +def request(command, url, headers={}, data=None): + """Mini-requests.""" + + class Dummy: + pass + + parts = urllib.parse.urlparse(url) + c = http.client.HTTPConnection(parts.hostname, parts.port) + c.request( + command, + urllib.parse.urlunparse(parts._replace(scheme="", netloc="")), + headers=headers, + body=data, + ) + r = c.getresponse() + result = Dummy() + result.status_code = r.status + result.headers = r.headers + result.content = r.read() + return result + + +class RequestHandler(http.server.BaseHTTPRequestHandler): + def do_GET(self): + if self.path == "/": + self.send_response(200) + self.send_header("Content-Type", "text/plain") + self.end_headers() + self.wfile.write(b"OK") + else: + self.do_HEAD() + + def do_PUT(self): + self.do_HEAD() + + def do_DELETE(self): + self.do_HEAD() + + def do_POST(self): + query = urllib.parse.urlparse(self.path).query + params = urllib.parse.parse_qs(query, keep_blank_values=True) + if "delete" in params: + self.send_response(501) + self.send_header("Content-Type", "application/xml") + self.end_headers() + self.wfile.write( + b""" + + NotImplemented + Ima GCP and I can't do `DeleteObjects` request for ya. See https://issuetracker.google.com/issues/162653700 . + RESOURCE + REQUEST_ID +""" + ) + else: + self.do_HEAD() + + def do_HEAD(self): + content_length = self.headers.get("Content-Length") + data = self.rfile.read(int(content_length)) if content_length else None + r = request( + self.command, + f"http://{UPSTREAM_HOST}{self.path}", + headers=self.headers, + data=data, + ) + self.send_response(r.status_code) + for k, v in r.headers.items(): + self.send_header(k, v) + self.end_headers() + self.wfile.write(r.content) + self.wfile.close() + + +class ThreadedHTTPServer(socketserver.ThreadingMixIn, http.server.HTTPServer): + """Handle requests in a separate thread.""" + + +httpd = ThreadedHTTPServer(("0.0.0.0", int(sys.argv[1])), RequestHandler) +httpd.serve_forever() diff --git a/tests/integration/test_merge_tree_s3/test.py b/tests/integration/test_merge_tree_s3/test.py index b7ef3ce3ef2..b04b0224613 100644 --- a/tests/integration/test_merge_tree_s3/test.py +++ b/tests/integration/test_merge_tree_s3/test.py @@ -67,7 +67,10 @@ def create_table(node, table_name, **additional_settings): def run_s3_mocks(cluster): logging.info("Starting s3 mocks") - mocks = (("unstable_proxy.py", "resolver", "8081"),) + mocks = ( + ("unstable_proxy.py", "resolver", "8081"), + ("no_delete_objects.py", "resolver", "8082"), + ) for mock_filename, container, port in mocks: container_id = cluster.get_container_id(container) current_dir = os.path.dirname(__file__) @@ -602,6 +605,15 @@ def restart_disk(): thread.join() +@pytest.mark.parametrize("node_name", ["node"]) +def test_s3_no_delete_objects(cluster, node_name): + node = cluster.instances[node_name] + create_table( + node, "s3_test_no_delete_objects", storage_policy="no_delete_objects_s3" + ) + node.query("DROP TABLE s3_test_no_delete_objects SYNC") + + @pytest.mark.parametrize("node_name", ["node"]) def test_s3_disk_reads_on_unstable_connection(cluster, node_name): node = cluster.instances[node_name] diff --git a/tests/integration/test_replicated_users/test.py b/tests/integration/test_replicated_users/test.py index add45d262e6..56383f0d2df 100644 --- a/tests/integration/test_replicated_users/test.py +++ b/tests/integration/test_replicated_users/test.py @@ -41,7 +41,7 @@ class Entity: def get_entity_id(entity): - return entity.keyword + return entity.keyword.replace(" ", "_") @pytest.mark.parametrize("entity", entities, ids=get_entity_id) diff --git a/tests/integration/test_s3_zero_copy_replication/test.py b/tests/integration/test_s3_zero_copy_replication/test.py index d7aa4feb1d2..1ce1047ebec 100644 --- a/tests/integration/test_s3_zero_copy_replication/test.py +++ b/tests/integration/test_s3_zero_copy_replication/test.py @@ -361,6 +361,8 @@ def test_s3_zero_copy_with_ttl_delete(cluster, large_data, iterations): ) node1.query("OPTIMIZE TABLE ttl_delete_test FINAL") + + node1.query("SYSTEM SYNC REPLICA ttl_delete_test") node2.query("SYSTEM SYNC REPLICA ttl_delete_test") if large_data: diff --git a/tests/integration/test_s3_zero_copy_ttl/test.py b/tests/integration/test_s3_zero_copy_ttl/test.py index 14b4664fcc1..9a782aacef6 100644 --- a/tests/integration/test_s3_zero_copy_ttl/test.py +++ b/tests/integration/test_s3_zero_copy_ttl/test.py @@ -68,19 +68,27 @@ def test_ttl_move_and_s3(started_cluster): assert node1.query("SELECT COUNT() FROM s3_test_with_ttl") == "30\n" assert node2.query("SELECT COUNT() FROM s3_test_with_ttl") == "30\n" - time.sleep(5) + for attempt in reversed(range(5)): + time.sleep(5) - print( - node1.query( - "SELECT * FROM system.parts WHERE table = 's3_test_with_ttl' FORMAT Vertical" + print( + node1.query( + "SELECT * FROM system.parts WHERE table = 's3_test_with_ttl' FORMAT Vertical" + ) ) - ) - - minio = cluster.minio_client - objects = minio.list_objects(cluster.minio_bucket, "data/", recursive=True) - counter = 0 - for obj in objects: - print("Objectname:", obj.object_name, "metadata:", obj.metadata) - counter += 1 - print("Total objects", counter) + + minio = cluster.minio_client + objects = minio.list_objects(cluster.minio_bucket, "data/", recursive=True) + counter = 0 + for obj in objects: + print(f"Objectname: {obj.object_name}, metadata: {obj.metadata}") + counter += 1 + + print(f"Total objects: {counter}") + + if counter == 300: + break + + print(f"Attempts remaining: {attempt}") + assert counter == 300 diff --git a/tests/integration/test_storage_kafka/test.py b/tests/integration/test_storage_kafka/test.py index a27b5a134e4..45a944b8d93 100644 --- a/tests/integration/test_storage_kafka/test.py +++ b/tests/integration/test_storage_kafka/test.py @@ -30,12 +30,24 @@ from kafka.protocol.group import MemberAssignment from kafka.admin import NewTopic +from pathlib import Path +from helpers.cluster import run_and_check # protoc --version # libprotoc 3.0.0 # # to create kafka_pb2.py # protoc --python_out=. kafka.proto +# Regenerate _pb2 files on each run, to make sure test doesn't depend installed protobuf version +proto_dir = Path(__file__).parent / "clickhouse_path/format_schemas" +gen_dir = Path(__file__).parent +gen_dir.mkdir(exist_ok=True) +run_and_check( + f"python3 -m grpc_tools.protoc -I{proto_dir!s} --python_out={gen_dir!s} --grpc_python_out={gen_dir!s} \ + {proto_dir!s}/kafka.proto", + shell=True, +) + from . import kafka_pb2 from . import social_pb2 from . import message_with_repeated_pb2 diff --git a/tests/queries/0_stateless/00900_orc_load.sh b/tests/queries/0_stateless/00900_orc_load.sh index b3f2c39e5d2..62149fa554e 100755 --- a/tests/queries/0_stateless/00900_orc_load.sh +++ b/tests/queries/0_stateless/00900_orc_load.sh @@ -5,16 +5,13 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) # shellcheck source=../shell_config.sh . "$CUR_DIR"/../shell_config.sh -DATA_FILE=$CUR_DIR/data_orc/test.orc - ${CLICKHOUSE_CLIENT} --query="DROP TABLE IF EXISTS orc_load" ${CLICKHOUSE_CLIENT} --query="CREATE TABLE orc_load (int Int32, smallint Int8, bigint Int64, float Float32, double Float64, date Date, y String, datetime64 DateTime64(3)) ENGINE = Memory" ${CLICKHOUSE_CLIENT} --query="insert into orc_load values (0, 0, 0, 0, 0, '2019-01-01', 'test1', toDateTime64('2019-01-01 02:03:04.567', 3)), (2147483647, -1, 9223372036854775806, 123.345345, 345345.3453451212, '2019-01-01', 'test2', toDateTime64('2019-01-01 02:03:04.567', 3))" -${CLICKHOUSE_CLIENT} --query="select * from orc_load FORMAT ORC" > $DATA_FILE +${CLICKHOUSE_CLIENT} --query="select * from orc_load FORMAT ORC" > "${CLICKHOUSE_TMP}"/test.orc ${CLICKHOUSE_CLIENT} --query="truncate table orc_load" -cat "$DATA_FILE" | ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" -timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" < $DATA_FILE +cat "${CLICKHOUSE_TMP}"/test.orc | ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" +timeout 3 ${CLICKHOUSE_CLIENT} -q "insert into orc_load format ORC" < "${CLICKHOUSE_TMP}"/test.orc ${CLICKHOUSE_CLIENT} --query="select * from orc_load" ${CLICKHOUSE_CLIENT} --query="drop table orc_load" -rm -rf "$DATA_FILE" diff --git a/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order.reference b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order.reference new file mode 100644 index 00000000000..00eb03bd5f0 --- /dev/null +++ b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order.reference @@ -0,0 +1,21 @@ +Partial sorting plan + optimize_read_in_window_order=0 + Sort description: n ASC, x ASC + optimize_read_in_window_order=1 + Prefix sort description: n ASC + Result sort description: n ASC, x ASC +No sorting plan + optimize_read_in_window_order=0 + Sort description: n ASC, x ASC + optimize_read_in_window_order=1 + Prefix sort description: n ASC, x ASC + Result sort description: n ASC, x ASC +Complex ORDER BY + optimize_read_in_window_order=0 +3 3 1 +4 5 2 +5 7 3 + optimize_read_in_window_order=1 +3 3 1 +4 5 2 +5 7 3 diff --git a/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order.sh b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order.sh new file mode 100755 index 00000000000..328d181fadd --- /dev/null +++ b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +# shellcheck source=../shell_config.sh +. "$CURDIR"/../shell_config.sh + +name=test_01655_plan_optimizations_optimize_read_in_window_order + +$CLICKHOUSE_CLIENT -q "drop table if exists ${name}" +$CLICKHOUSE_CLIENT -q "drop table if exists ${name}_n" +$CLICKHOUSE_CLIENT -q "drop table if exists ${name}_n_x" + +$CLICKHOUSE_CLIENT -q "create table ${name} engine=MergeTree order by tuple() as select toInt64((sin(number)+2)*65535)%10 as n, number as x from numbers_mt(100000)" +$CLICKHOUSE_CLIENT -q "create table ${name}_n engine=MergeTree order by n as select * from ${name} order by n" +$CLICKHOUSE_CLIENT -q "create table ${name}_n_x engine=MergeTree order by (n, x) as select * from ${name} order by n, x" + +$CLICKHOUSE_CLIENT -q "optimize table ${name}_n final" +$CLICKHOUSE_CLIENT -q "optimize table ${name}_n_x final" + +echo 'Partial sorting plan' +echo ' optimize_read_in_window_order=0' +$CLICKHOUSE_CLIENT -q "explain plan actions=1, description=1 select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n SETTINGS optimize_read_in_window_order=0" | grep -i "sort description" + +echo ' optimize_read_in_window_order=1' +$CLICKHOUSE_CLIENT -q "explain plan actions=1, description=1 select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n SETTINGS optimize_read_in_window_order=1" | grep -i "sort description" + +echo 'No sorting plan' +echo ' optimize_read_in_window_order=0' +$CLICKHOUSE_CLIENT -q "explain plan actions=1, description=1 select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n_x SETTINGS optimize_read_in_window_order=0" | grep -i "sort description" + +echo ' optimize_read_in_window_order=1' +$CLICKHOUSE_CLIENT -q "explain plan actions=1, description=1 select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n_x SETTINGS optimize_read_in_window_order=1" | grep -i "sort description" + +echo 'Complex ORDER BY' +$CLICKHOUSE_CLIENT -q "CREATE TABLE ${name}_complex (unique1 Int32, unique2 Int32, ten Int32) ENGINE=MergeTree ORDER BY tuple() SETTINGS index_granularity = 8192" +$CLICKHOUSE_CLIENT -q "INSERT INTO ${name}_complex VALUES (1, 2, 3), (2, 3, 4), (3, 4, 5)" +echo ' optimize_read_in_window_order=0' +$CLICKHOUSE_CLIENT -q "SELECT ten, sum(unique1) + sum(unique2) AS res, rank() OVER (ORDER BY sum(unique1) + sum(unique2) ASC) AS rank FROM ${name}_complex GROUP BY ten ORDER BY ten ASC SETTINGS optimize_read_in_window_order=0" +echo ' optimize_read_in_window_order=1' +$CLICKHOUSE_CLIENT -q "SELECT ten, sum(unique1) + sum(unique2) AS res, rank() OVER (ORDER BY sum(unique1) + sum(unique2) ASC) AS rank FROM ${name}_complex GROUP BY ten ORDER BY ten ASC SETTINGS optimize_read_in_window_order=1" + +$CLICKHOUSE_CLIENT -q "drop table ${name}" +$CLICKHOUSE_CLIENT -q "drop table ${name}_n" +$CLICKHOUSE_CLIENT -q "drop table ${name}_n_x" +$CLICKHOUSE_CLIENT -q "drop table ${name}_complex" diff --git a/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order_long.reference b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order_long.reference new file mode 100644 index 00000000000..b462a5a7baa --- /dev/null +++ b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order_long.reference @@ -0,0 +1,4 @@ +OK +OK +OK +OK diff --git a/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order_long.sh b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order_long.sh new file mode 100755 index 00000000000..297688a29c3 --- /dev/null +++ b/tests/queries/0_stateless/01655_plan_optimizations_optimize_read_in_window_order_long.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Tags: long + +CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) +# shellcheck source=../shell_config.sh +. "$CURDIR"/../shell_config.sh + +name=test_01655_plan_optimizations_optimize_read_in_window_order_long +max_memory_usage=20000000 + +$CLICKHOUSE_CLIENT -q "drop table if exists ${name}" +$CLICKHOUSE_CLIENT -q "drop table if exists ${name}_n" +$CLICKHOUSE_CLIENT -q "drop table if exists ${name}_n_x" + +$CLICKHOUSE_CLIENT -q "create table ${name} engine=MergeTree order by tuple() as select toInt64((sin(number)+2)*65535)%500 as n, number as x from numbers_mt(5000000)" +$CLICKHOUSE_CLIENT -q "create table ${name}_n engine=MergeTree order by n as select * from ${name} order by n" +$CLICKHOUSE_CLIENT -q "create table ${name}_n_x engine=MergeTree order by (n, x) as select * from ${name} order by n, x" + +$CLICKHOUSE_CLIENT -q "optimize table ${name}_n final" +$CLICKHOUSE_CLIENT -q "optimize table ${name}_n_x final" + +$CLICKHOUSE_CLIENT -q "select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n SETTINGS optimize_read_in_window_order=0, max_memory_usage=$max_memory_usage, max_threads=1 format Null" 2>&1 | grep -F -q "MEMORY_LIMIT_EXCEEDED" && echo 'OK' || echo 'FAIL' +$CLICKHOUSE_CLIENT -q "select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n SETTINGS optimize_read_in_window_order=1, max_memory_usage=$max_memory_usage, max_threads=1 format Null" + +$CLICKHOUSE_CLIENT -q "select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n_x SETTINGS optimize_read_in_window_order=0, max_memory_usage=$max_memory_usage, max_threads=1 format Null" 2>&1 | grep -F -q "MEMORY_LIMIT_EXCEEDED" && echo 'OK' || echo 'FAIL' +$CLICKHOUSE_CLIENT -q "select n, sum(x) OVER (ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n_x SETTINGS optimize_read_in_window_order=1, max_memory_usage=$max_memory_usage, max_threads=1 format Null" + +$CLICKHOUSE_CLIENT -q "select n, sum(x) OVER (PARTITION BY n ORDER BY x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n_x SETTINGS optimize_read_in_window_order=0, max_memory_usage=$max_memory_usage, max_threads=1 format Null" 2>&1 | grep -F -q "MEMORY_LIMIT_EXCEEDED" && echo 'OK' || echo 'FAIL' +$CLICKHOUSE_CLIENT -q "select n, sum(x) OVER (PARTITION BY n ORDER BY x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n_x SETTINGS optimize_read_in_window_order=1, max_memory_usage=$max_memory_usage, max_threads=1 format Null" + +$CLICKHOUSE_CLIENT -q "select n, sum(x) OVER (PARTITION BY n+x%2 ORDER BY n, x ROWS BETWEEN 100 PRECEDING AND CURRENT ROW) from ${name}_n_x SETTINGS optimize_read_in_window_order=1, max_memory_usage=$max_memory_usage, max_threads=1 format Null" 2>&1 | grep -F -q "MEMORY_LIMIT_EXCEEDED" && echo 'OK' || echo 'FAIL' + +$CLICKHOUSE_CLIENT -q "drop table ${name}" +$CLICKHOUSE_CLIENT -q "drop table ${name}_n" +$CLICKHOUSE_CLIENT -q "drop table ${name}_n_x" diff --git a/tests/queries/0_stateless/02020_exponential_smoothing.reference b/tests/queries/0_stateless/02020_exponential_smoothing.reference index b3c23420678..5481bfe80f8 100644 --- a/tests/queries/0_stateless/02020_exponential_smoothing.reference +++ b/tests/queries/0_stateless/02020_exponential_smoothing.reference @@ -1,13 +1,14 @@ +exponentialMovingAverage 1 0 0.5 0 1 0.25 0 2 0.125 -0 3 0.0625 -0 4 0.03125 -0 5 0.015625 -0 6 0.0078125 -0 7 0.00390625 -0 8 0.001953125 -0 9 0.0009765625 +0 3 0.062 +0 4 0.031 +0 5 0.016 +0 6 0.008 +0 7 0.004 +0 8 0.002 +0 9 0.001 1 0 0.067 0 1 0.062 0 2 0.058 @@ -128,16 +129,17 @@ 0 47 0.129 ██████▍ 0 48 0.065 ███▏ 0 49 0.032 █▌ +exponentialTimeDecayedSum 1 0 1 -0 1 0.36787944117144233 -0 2 0.1353352832366127 -0 3 0.04978706836786395 -0 4 0.018315638888734186 -0 5 0.00673794699908547 -0 6 0.0024787521766663594 -0 7 0.0009118819655545166 -0 8 0.00033546262790251196 -0 9 0.0001234098040866796 +0 1 0.368 +0 2 0.135 +0 3 0.05 +0 4 0.018 +0 5 0.007 +0 6 0.002 +0 7 0.001 +0 8 0 +0 9 0 1 0 1 0 1 0.905 0 2 0.819 @@ -258,16 +260,17 @@ 0 47 0.136 ██████▋ 0 48 0.05 ██▌ 0 49 0.018 ▊ +exponentialTimeDecayedMax 1 0 1 -0 1 0.36787944117144233 -0 2 0.1353352832366127 -0 3 0.04978706836786395 -0 4 0.018315638888734186 -0 5 0.00673794699908547 -0 6 0.0024787521766663594 -0 7 0.0009118819655545166 -0 8 0.00033546262790251196 -0 9 0.0001234098040866796 +0 1 0.368 +0 2 0.135 +0 3 0.05 +0 4 0.018 +0 5 0.007 +0 6 0.002 +0 7 0.001 +0 8 0 +0 9 0 1 0 1 0 1 0.905 0 2 0.819 @@ -388,16 +391,17 @@ 0 47 0.135 ██████▋ 0 48 0.05 ██▍ 0 49 0.018 ▊ +exponentialTimeDecayedCount 1 0 1 -0 1 1.3678794411714423 -0 2 1.5032147244080551 -0 3 1.553001792775919 -0 4 1.5713174316646532 -0 5 1.5780553786637386 -0 6 1.5805341308404048 -0 7 1.5814460128059595 -0 8 1.581781475433862 -0 9 1.5819048852379487 +0 1 1.368 +0 2 1.503 +0 3 1.553 +0 4 1.571 +0 5 1.578 +0 6 1.581 +0 7 1.581 +0 8 1.582 +0 9 1.582 1 0 1 0 1 1.905 0 2 2.724 @@ -518,16 +522,17 @@ 0 47 10.422 ██████████████████████████ 0 48 10.43 ██████████████████████████ 0 49 10.438 ██████████████████████████ +exponentialTimeDecayedAvg 1 0 1 -0 1 0.2689414213699951 -0 2 0.09003057317038046 -0 3 0.032058603280084995 -0 4 0.01165623095603961 -0 5 0.004269778545282112 -0 6 0.0015683003158864733 -0 7 0.000576612769687006 -0 8 0.00021207899644323433 -0 9 0.00007801341612780745 +0 1 0.269 +0 2 0.09 +0 3 0.032 +0 4 0.012 +0 5 0.004 +0 6 0.002 +0 7 0.001 +0 8 0 +0 9 0 1 0 1 0 1 0.475 0 2 0.301 @@ -648,3 +653,24 @@ 0 47 0.206 ████████████████████▋ 0 48 0.201 ████████████████████ 0 49 0.196 ███████████████████▌ +Check `exponentialTimeDecayed.*` supports sliding windows +2 1 2.950447180363 1.960397346614 2.970248507056 0.993333444442 +1 2 6.921089740404 4 3.940694040604 1.756312382816 +0 3 11.85222374685 5 4.901483479757 2.418089094006 +4 4 10.831833301125 4.950249168746 4.901483479757 2.209909172572 +5 5 9.772825334477 4.900993366534 4.901483479757 1.993850509716 +1 6 19.675584097659 10 4.901483479757 4.014210020072 +0 7 15.832426341049 10 3.940694040604 4.017674596889 +10 8 10.980198673307 10 2.970248507056 3.696727276261 +Check `exponentialTimeDecayedMax` works with negative values +2 1 -0.990049833749 +1 2 -0.980198673307 +10 3 -0.970445533549 +4 4 -0.960789439152 +5 5 -0.990049833749 +1 6 -0.980198673307 +10 7 -0.970445533549 +10 8 -0.960789439152 +10 9 -9.607894391523 +9.81 10 -9.704455335485 +9.9 11 -9.712388869079 diff --git a/tests/queries/0_stateless/02020_exponential_smoothing.sql b/tests/queries/0_stateless/02020_exponential_smoothing.sql index a39b09a883d..462081b12d6 100644 --- a/tests/queries/0_stateless/02020_exponential_smoothing.sql +++ b/tests/queries/0_stateless/02020_exponential_smoothing.sql @@ -1,5 +1,6 @@ --- exponentialMovingAverage -SELECT number = 0 AS value, number AS time, exponentialMovingAverage(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); +SELECT 'exponentialMovingAverage'; + +SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialMovingAverage(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialMovingAverage(10)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT number AS value, number AS time, exponentialMovingAverage(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); @@ -32,8 +33,9 @@ FROM FROM numbers(50) ); --- exponentialTimeDecayedSum -SELECT number = 0 AS value, number AS time, exponentialTimeDecayedSum(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); +SELECT 'exponentialTimeDecayedSum'; + +SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedSum(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedSum(10)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT number AS value, number AS time, exponentialTimeDecayedSum(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); @@ -66,8 +68,9 @@ FROM FROM numbers(50) ); --- exponentialTimeDecayedMax -SELECT number = 0 AS value, number AS time, exponentialTimeDecayedMax(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); +SELECT 'exponentialTimeDecayedMax'; + +SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedMax(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedMax(10)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT number AS value, number AS time, exponentialTimeDecayedMax(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); @@ -100,8 +103,9 @@ FROM FROM numbers(50) ); --- exponentialTimeDecayedCount -SELECT number = 0 AS value, number AS time, exponentialTimeDecayedCount(1)(time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); +SELECT 'exponentialTimeDecayedCount'; + +SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedCount(1)(time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedCount(10)(time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT number AS value, number AS time, exponentialTimeDecayedCount(1)(time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); @@ -134,8 +138,9 @@ FROM FROM numbers(50) ); --- exponentialTimeDecayedAvg -SELECT number = 0 AS value, number AS time, exponentialTimeDecayedAvg(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); +SELECT 'exponentialTimeDecayedAvg'; + +SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedAvg(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT value, time, round(exp_smooth, 3) FROM (SELECT number = 0 AS value, number AS time, exponentialTimeDecayedAvg(10)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10)); SELECT number AS value, number AS time, exponentialTimeDecayedAvg(1)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(10); @@ -167,3 +172,70 @@ FROM exponentialTimeDecayedAvg(100)(value, time) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS exp_smooth FROM numbers(50) ); + +SELECT 'Check `exponentialTimeDecayed.*` supports sliding windows'; + +SELECT + x, + t, + round(sum, 12), + round(max, 12), + round(count, 12), + round(avg, 12) +FROM +( + SELECT + d[1] AS x, + d[2] AS t, + exponentialTimeDecayedSum(100)(x, t) OVER w AS sum, + exponentialTimeDecayedMax(100)(x, t) OVER w AS max, + exponentialTimeDecayedCount(100)(t) OVER w AS count, + exponentialTimeDecayedAvg(100)(x, t) OVER w AS avg + FROM + ( + SELECT [[2, 1], [1, 2], [0, 3], [4, 4], [5, 5], [1, 6], [0, 7], [10, 8]] AS d + ) + ARRAY JOIN d + WINDOW w AS (ORDER BY 1 ASC Rows BETWEEN 2 PRECEDING AND 2 FOLLOWING) +); + +SELECT + x, + t, + round(sum, 12), + round(max, 12), + round(count, 12), + round(avg, 12) +FROM +( + SELECT + sin(number) AS x, + number AS t, + exponentialTimeDecayedSum(100)(x, t) OVER w AS sum, + exponentialTimeDecayedMax(100)(x, t) OVER w AS max, + exponentialTimeDecayedCount(100)(t) OVER w AS count, + exponentialTimeDecayedAvg(100)(x, t) OVER w AS avg + FROM numbers(1000000) + WINDOW w AS (ORDER BY 1 ASC Rows BETWEEN 2 PRECEDING AND 2 FOLLOWING) +) +FORMAT `Null`; + +SELECT 'Check `exponentialTimeDecayedMax` works with negative values'; + +SELECT + x, + t, + round(max, 12) +FROM +( + SELECT + d[1] AS x, + d[2] AS t, + exponentialTimeDecayedMax(100)(-x, t) OVER w AS max + FROM + ( + SELECT [[2, 1], [1, 2], [10, 3], [4, 4], [5, 5], [1, 6], [10, 7], [10, 8], [10, 9], [9.81, 10], [9.9, 11]] AS d + ) + ARRAY JOIN d + WINDOW w AS (ORDER BY 1 ASC Rows BETWEEN 2 PRECEDING AND 2 FOLLOWING) +); diff --git a/tests/queries/0_stateless/02354_with_statement_non_exist_column.reference b/tests/queries/0_stateless/02354_with_statement_non_exist_column.reference new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/tests/queries/0_stateless/02354_with_statement_non_exist_column.reference @@ -0,0 +1 @@ +1 diff --git a/tests/queries/0_stateless/02354_with_statement_non_exist_column.sql b/tests/queries/0_stateless/02354_with_statement_non_exist_column.sql new file mode 100644 index 00000000000..1a989c1d952 --- /dev/null +++ b/tests/queries/0_stateless/02354_with_statement_non_exist_column.sql @@ -0,0 +1,9 @@ +WITH x AS y SELECT 1; + +DROP TEMPORARY TABLE IF EXISTS t1; +DROP TEMPORARY TABLE IF EXISTS t2; + +CREATE TEMPORARY TABLE t1 (a Int64); +CREATE TEMPORARY TABLE t2 (a Int64, b Int64); + +WITH b AS bb SELECT bb FROM t2 WHERE a IN (SELECT a FROM t1); diff --git a/tests/testflows/aes_encryption/aes_encryption_env/clickhouse-service.yml b/tests/testflows/aes_encryption/aes_encryption_env/clickhouse-service.yml index 0c9352dbc0b..532ce918573 100644 --- a/tests/testflows/aes_encryption/aes_encryption_env/clickhouse-service.yml +++ b/tests/testflows/aes_encryption/aes_encryption_env/clickhouse-service.yml @@ -2,25 +2,31 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 + init: true expose: - "9000" - "9009" - "8123" volumes: - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.d/:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/ssl:/etc/clickhouse-server/ssl" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/common.xml:/etc/clickhouse-server/common.xml" - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" - entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + entrypoint: bash -c "tail -f /dev/null" healthcheck: - test: clickhouse client --query='select 1' + test: echo 1 interval: 10s timeout: 10s - retries: 10 + retries: 3 start_period: 300s cap_add: - SYS_PTRACE diff --git a/tests/testflows/aes_encryption/aes_encryption_env/docker-compose.yml b/tests/testflows/aes_encryption/aes_encryption_env/docker-compose.yml index 124b53bf502..3224c1fd766 100644 --- a/tests/testflows/aes_encryption/aes_encryption_env/docker-compose.yml +++ b/tests/testflows/aes_encryption/aes_encryption_env/docker-compose.yml @@ -22,8 +22,12 @@ services: volumes: - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" depends_on: zookeeper: condition: service_healthy @@ -36,8 +40,12 @@ services: volumes: - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/database/:/var/lib/clickhouse/" - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/logs/:/var/log/clickhouse-server/" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" depends_on: zookeeper: condition: service_healthy @@ -50,8 +58,12 @@ services: volumes: - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/database/:/var/lib/clickhouse/" - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/logs/:/var/log/clickhouse-server/" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" depends_on: zookeeper: condition: service_healthy @@ -59,7 +71,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: mysql1: condition: service_healthy diff --git a/tests/testflows/aes_encryption/aes_encryption_env/mysql-service.yml b/tests/testflows/aes_encryption/aes_encryption_env/mysql-service.yml index 6924bccfad5..5423b0e0dab 100644 --- a/tests/testflows/aes_encryption/aes_encryption_env/mysql-service.yml +++ b/tests/testflows/aes_encryption/aes_encryption_env/mysql-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: mysql: - image: mysql:5.7.30 + image: ${IMAGE_DEPENDENCY_PROXY}mysql:5.7.30 restart: always environment: MYSQL_DATABASE: 'db' diff --git a/tests/testflows/aes_encryption/aes_encryption_env/zookeeper-service.yml b/tests/testflows/aes_encryption/aes_encryption_env/zookeeper-service.yml index f27405b97a2..60c0e4e7de3 100644 --- a/tests/testflows/aes_encryption/aes_encryption_env/zookeeper-service.yml +++ b/tests/testflows/aes_encryption/aes_encryption_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.6.2 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/aes_encryption/aes_encryption_env_arm64/clickhouse-service.yml b/tests/testflows/aes_encryption/aes_encryption_env_arm64/clickhouse-service.yml new file mode 100644 index 00000000000..0923283ac84 --- /dev/null +++ b/tests/testflows/aes_encryption/aes_encryption_env_arm64/clickhouse-service.yml @@ -0,0 +1,32 @@ +version: '2.3' + +services: + clickhouse: + image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:21.12 + expose: + - "9000" + - "9009" + - "8123" + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/ssl:/etc/clickhouse-server/ssl" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" + - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" + entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + healthcheck: + test: clickhouse client --query='select 1' + interval: 10s + timeout: 10s + retries: 10 + start_period: 300s + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/tests/testflows/aes_encryption/aes_encryption_env_arm64/docker-compose.yml b/tests/testflows/aes_encryption/aes_encryption_env_arm64/docker-compose.yml new file mode 100644 index 00000000000..3224c1fd766 --- /dev/null +++ b/tests/testflows/aes_encryption/aes_encryption_env_arm64/docker-compose.yml @@ -0,0 +1,85 @@ +version: '2.3' + +services: + zookeeper: + extends: + file: zookeeper-service.yml + service: zookeeper + + mysql1: + extends: + file: mysql-service.yml + service: mysql + hostname: mysql1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/mysql1/database:/var/lib/mysql" + + clickhouse1: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse2: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse2 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse3: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse3 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" + depends_on: + zookeeper: + condition: service_healthy + + # dummy service which does nothing, but allows to postpone + # 'docker-compose up -d' till all dependecies will go healthy + all_services_ready: + image: ${IMAGE_DEPENDENCY_PROXY}hello-world + depends_on: + mysql1: + condition: service_healthy + clickhouse1: + condition: service_healthy + clickhouse2: + condition: service_healthy + clickhouse3: + condition: service_healthy + zookeeper: + condition: service_healthy diff --git a/tests/testflows/aes_encryption/aes_encryption_env_arm64/mysql-service.yml b/tests/testflows/aes_encryption/aes_encryption_env_arm64/mysql-service.yml new file mode 100644 index 00000000000..fe957e7be0f --- /dev/null +++ b/tests/testflows/aes_encryption/aes_encryption_env_arm64/mysql-service.yml @@ -0,0 +1,19 @@ +version: '2.3' + +services: + mysql: + image: ${IMAGE_DEPENDENCY_PROXY}mariadb:10.3 + restart: always + environment: + MYSQL_DATABASE: 'db' + MYSQL_USER: 'user' + MYSQL_PASSWORD: 'password' + MYSQL_ROOT_PASSWORD: 'password' + expose: + - '3306' + healthcheck: + test: mysql -D db -u user --password=password -e "select 1;" + interval: 3s + timeout: 2s + retries: 40 + start_period: 2s diff --git a/tests/testflows/aes_encryption/aes_encryption_env_arm64/zookeeper-service.yml b/tests/testflows/aes_encryption/aes_encryption_env_arm64/zookeeper-service.yml new file mode 100644 index 00000000000..60c0e4e7de3 --- /dev/null +++ b/tests/testflows/aes_encryption/aes_encryption_env_arm64/zookeeper-service.yml @@ -0,0 +1,18 @@ +version: '2.3' + +services: + zookeeper: + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 + expose: + - "2181" + environment: + ZOO_TICK_TIME: 500 + ZOO_MY_ID: 1 + healthcheck: + test: echo stat | nc localhost 2181 + interval: 3s + timeout: 2s + retries: 5 + start_period: 2s + security_opt: + - label:disable diff --git a/tests/testflows/aes_encryption/configs/clickhouse/common.xml b/tests/testflows/aes_encryption/configs/clickhouse/common.xml new file mode 100644 index 00000000000..31fa972199f --- /dev/null +++ b/tests/testflows/aes_encryption/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + 0.0.0.0 + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/aes_encryption/configs/clickhouse/config.xml b/tests/testflows/aes_encryption/configs/clickhouse/config.xml new file mode 100644 index 00000000000..9854f9f990e --- /dev/null +++ b/tests/testflows/aes_encryption/configs/clickhouse/config.xml @@ -0,0 +1,436 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + /var/lib/clickhouse/access/ + + + users.xml + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 7200 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/aes_encryption/configs/clickhouse/users.xml b/tests/testflows/aes_encryption/configs/clickhouse/users.xml new file mode 100644 index 00000000000..c7d0ecae693 --- /dev/null +++ b/tests/testflows/aes_encryption/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/aes_encryption/regression.py b/tests/testflows/aes_encryption/regression.py index c12aaca861d..d9750206977 100755 --- a/tests/testflows/aes_encryption/regression.py +++ b/tests/testflows/aes_encryption/regression.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from gettext import find import os import sys from testflows.core import * @@ -13,8 +14,11 @@ issue_18250 = "https://github.com/ClickHouse/ClickHouse/issues/18250" issue_18251 = "https://github.com/ClickHouse/ClickHouse/issues/18251" issue_24029 = "https://github.com/ClickHouse/ClickHouse/issues/24029" +issue_39987 = "https://github.com/ClickHouse/ClickHouse/issues/39987" xfails = { + # decrypt + "decrypt/invalid parameters/null in ciphertext": [(Fail, issue_39987)], # encrypt "encrypt/invalid key or iv length for mode/mode=\"'aes-???-gcm'\", key_len=??, iv_len=12, aad=True/iv is too short": [ (Fail, "known issue") @@ -81,23 +85,30 @@ RQ_SRS008_AES_Functions("1.0"), RQ_SRS008_AES_Functions_DifferentModes("1.0") ) @XFails(xfails) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """ClickHouse AES encryption functions regression module.""" nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), } + self.context.clickhouse_version = clickhouse_version + if stress is not None: self.context.stress = stress - self.context.clickhouse_version = clickhouse_version + + from platform import processor as current_cpu + + folder_name = os.path.basename(current_dir()) + if current_cpu() == "aarch64": + env = f"{folder_name}_env_arm64" + else: + env = f"{folder_name}_env" with Cluster( local, clickhouse_binary_path, nodes=nodes, - docker_compose_project_dir=os.path.join(current_dir(), "aes_encryption_env"), + docker_compose_project_dir=os.path.join(current_dir(), env), ) as cluster: self.context.cluster = cluster diff --git a/tests/testflows/aes_encryption/tests/common.py b/tests/testflows/aes_encryption/tests/common.py index f0a10d34411..419996971a1 100644 --- a/tests/testflows/aes_encryption/tests/common.py +++ b/tests/testflows/aes_encryption/tests/common.py @@ -4,6 +4,7 @@ from testflows._core.testtype import TestSubType from testflows.core.name import basename, parentname from testflows.core import current +from helpers.common import * modes = [ # mode, key_len, iv_len, aad diff --git a/tests/testflows/aes_encryption/tests/decrypt.py b/tests/testflows/aes_encryption/tests/decrypt.py index 1c7d958737c..f5da0b12d38 100644 --- a/tests/testflows/aes_encryption/tests/decrypt.py +++ b/tests/testflows/aes_encryption/tests/decrypt.py @@ -94,10 +94,11 @@ def invalid_ciphertext(self): no_checks=True, step=By, ) - with Then("exitcode is not zero"): - assert r.exitcode in [198, 36] - with And("exception is present in the output"): - assert "DB::Exception:" in r.output + if check_clickhouse_version("<21.12")(self): + with Then("exitcode is not zero"): + assert r.exitcode in [198, 36] + with And("exception is present in the output"): + assert "DB::Exception:" in r.output @TestScenario @@ -303,6 +304,15 @@ def invalid_parameters(self): message="DB::Exception: Invalid mode: AES-128-ECB", ) + with Example("null in ciphertext"): + decrypt( + ciphertext="[6555, 555, 555, 9223372036854775807, 1048576, NULL]", + key="'0123456789123456'", + mode="'aes-128-ecb'", + exitcode=198, + message="DB::Exception: Failed to decrypt", + ) + @TestOutline(Scenario) @Requirements( diff --git a/tests/testflows/aes_encryption/tests/decrypt_mysql.py b/tests/testflows/aes_encryption/tests/decrypt_mysql.py index 1a8f53464b7..d307d87b90a 100644 --- a/tests/testflows/aes_encryption/tests/decrypt_mysql.py +++ b/tests/testflows/aes_encryption/tests/decrypt_mysql.py @@ -90,10 +90,12 @@ def invalid_ciphertext(self): no_checks=True, step=By, ) - with Then("exitcode is not zero"): - assert r.exitcode in [198, 36] - with And("exception is present in the output"): - assert "DB::Exception:" in r.output + + if check_clickhouse_version("<21.12")(self): + with Then("exitcode is not zero"): + assert r.exitcode in [198, 36] + with And("exception is present in the output"): + assert "DB::Exception:" in r.output @TestOutline(Scenario) diff --git a/tests/testflows/ci-runner.py b/tests/testflows/ci-runner.py new file mode 100755 index 00000000000..b69bf94d176 --- /dev/null +++ b/tests/testflows/ci-runner.py @@ -0,0 +1,248 @@ +#!/usr/bin/env python3 + +from collections import defaultdict +import sys +import json +import logging +import os +import shutil +import subprocess +import time + + +CLICKHOUSE_BINARY_PATH = "usr/bin/clickhouse" +CLICKHOUSE_ODBC_BRIDGE_BINARY_PATH = "usr/bin/clickhouse-odbc-bridge" +CLICKHOUSE_LIBRARY_BRIDGE_BINARY_PATH = "usr/bin/clickhouse-library-bridge" + +MAX_TIME_IN_SANDBOX = 20 * 60 # 20 minutes +TASK_TIMEOUT = 8 * 60 * 60 # 8 hours + + +def clear_ip_tables_and_restart_daemons(): + logging.info( + "Dump iptables after run %s", + subprocess.check_output("sudo iptables -L", shell=True), + ) + try: + logging.info("Killing all alive docker containers") + subprocess.check_output( + "timeout -s 9 10m docker kill $(docker ps -q)", shell=True + ) + except subprocess.CalledProcessError as err: + logging.info("docker kill excepted: " + str(err)) + + try: + logging.info("Removing all docker containers") + subprocess.check_output( + "timeout -s 9 10m docker rm $(docker ps -a -q) --force", shell=True + ) + except subprocess.CalledProcessError as err: + logging.info("docker rm excepted: " + str(err)) + + # don't restart docker if it's disabled + if os.environ.get("CLICKHOUSE_TESTS_RUNNER_RESTART_DOCKER", "1") == "1": + try: + logging.info("Stopping docker daemon") + subprocess.check_output("service docker stop", shell=True) + except subprocess.CalledProcessError as err: + logging.info("docker stop excepted: " + str(err)) + + try: + for i in range(200): + try: + logging.info("Restarting docker %s", i) + subprocess.check_output("service docker start", shell=True) + subprocess.check_output("docker ps", shell=True) + break + except subprocess.CalledProcessError as err: + time.sleep(0.5) + logging.info("Waiting docker to start, current %s", str(err)) + else: + raise Exception("Docker daemon doesn't responding") + except subprocess.CalledProcessError as err: + logging.info("Can't reload docker: " + str(err)) + + iptables_iter = 0 + try: + for i in range(1000): + iptables_iter = i + # when rules will be empty, it will raise exception + subprocess.check_output("sudo iptables -D DOCKER-USER 1", shell=True) + except subprocess.CalledProcessError as err: + logging.info( + "All iptables rules cleared, " + + str(iptables_iter) + + "iterations, last error: " + + str(err) + ) + + +class ClickhouseTestFlowsTestsRunner: + def __init__(self, result_path, params): + self.result_path = result_path + self.params = params + self.start_time = time.time() + self.disable_net_host = ( + "disable_net_host" in self.params and self.params["disable_net_host"] + ) + self.image_versions = self.params["docker_images_with_versions"] + + def path(self): + return self.result_path + + def base_path(self): + return os.path.join(str(self.result_path), "../") + + def _can_run_with(self, path, opt): + with open(path, "r") as script: + for line in script: + if opt in line: + return True + return False + + def _install_clickhouse(self, debs_path): + for package in ( + "clickhouse-common-static_", + "clickhouse-server_", + "clickhouse-client", + "clickhouse-common-static-dbg_", + ): # order matters + logging.info("Installing package %s", package) + for f in os.listdir(debs_path): + if package in f: + full_path = os.path.join(debs_path, f) + logging.info("Package found in %s", full_path) + log_name = "install_" + f + ".log" + log_path = os.path.join(str(self.path()), log_name) + with open(log_path, "w") as log: + cmd = "dpkg -x {} .".format(full_path) + logging.info("Executing installation cmd %s", cmd) + retcode = subprocess.Popen( + cmd, shell=True, stderr=log, stdout=log + ).wait() + if retcode == 0: + logging.info("Installation of %s successful", full_path) + else: + raise Exception("Installation of %s failed", full_path) + break + else: + raise Exception("Package with {} not found".format(package)) + + logging.info("All packages installed") + os.chmod(CLICKHOUSE_BINARY_PATH, 0o777) + os.chmod(CLICKHOUSE_ODBC_BRIDGE_BINARY_PATH, 0o777) + os.chmod(CLICKHOUSE_LIBRARY_BRIDGE_BINARY_PATH, 0o777) + shutil.copy( + CLICKHOUSE_BINARY_PATH, os.getenv("CLICKHOUSE_TESTS_SERVER_BIN_PATH") + ) + shutil.copy( + CLICKHOUSE_ODBC_BRIDGE_BINARY_PATH, + os.getenv("CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH"), + ) + shutil.copy( + CLICKHOUSE_LIBRARY_BRIDGE_BINARY_PATH, + os.getenv("CLICKHOUSE_TESTS_LIBRARY_BRIDGE_BIN_PATH"), + ) + + def _compress_logs(self, dir, relpaths, result_path): + subprocess.check_call( # STYLE_CHECK_ALLOW_SUBPROCESS_CHECK_CALL + "tar czf {} -C {} {}".format(result_path, dir, " ".join(relpaths)), + shell=True, + ) + + def _get_runner_opts(self): + result = [] + if self.disable_net_host: + result.append("--disable-net-host") + return " ".join(result) + + @staticmethod + def get_images_names(): + return [ + "altinityinfra/testflows-runner", + ] + + def get_image_version(self, name: str): + if name in self.image_versions: + return self.image_versions[name] + logging.warn( + "Cannot find image %s in params list %s", name, self.image_versions + ) + return "latest" + + def get_image_with_version(self, name): + if name in self.image_versions: + return name + ":" + self.image_versions[name] + logging.warn( + "Cannot find image %s in params list %s", name, self.image_versions + ) + if ":" not in name: + return name + ":latest" + return name + + def _get_runner_image_cmd(self, repo_path): + image_cmd = "" + if self._can_run_with( + os.path.join(repo_path, "tests/testflows", "runner"), + "--docker-image-version", + ): + for img in self.get_images_names(): + if img == "altinityinfra/testflows-runner": + runner_version = self.get_image_version(img) + logging.info( + "Can run with custom docker image version %s", runner_version + ) + image_cmd += " --docker-image-version={} ".format(runner_version) + else: + logging.info( + f"Cannot run with custom docker compose image version :( for {img}" + ) + else: + image_cmd = "" + logging.info("Cannot run with custom docker image version :(") + return image_cmd + + def run_impl(self, repo_path, build_path): + self._install_clickhouse(build_path) + logging.info( + "Dump iptables before run %s", + subprocess.check_output("sudo iptables -L", shell=True), + ) + + image_cmd = self._get_runner_image_cmd(repo_path) + + log_path = os.path.join(repo_path, "tests/testflows", "run.log") + test_log_path = os.path.join(repo_path, "tests/testflows", "test.log") + + cmd = ( + f'bash -c "set -o pipefail && cd {repo_path}/tests/testflows && timeout -s 9 10h ' + f'./runner {self._get_runner_opts()} {image_cmd} | tee {log_path}"' + ) + + logging.info("Executing cmd: %s", cmd) + retcode = subprocess.Popen( + cmd, shell=True, stderr=sys.stdout, stdout=sys.stdout + ).wait() + if retcode == 0: + logging.info("Run successfully") + else: + logging.info("Some tests failed") + + shutil.copy(log_path, os.path.join(str(self.path()), "run.log")) + shutil.copy(test_log_path, os.path.join(str(self.path()), "raw.log")) + + +if __name__ == "__main__": + logging.basicConfig(level=logging.INFO, format="%(asctime)s %(message)s") + + repo_path = os.environ.get("CLICKHOUSE_TESTS_REPO_PATH") + build_path = os.environ.get("CLICKHOUSE_TESTS_BUILD_PATH") + result_path = os.environ.get("CLICKHOUSE_TESTS_RESULT_PATH") + params_path = os.environ.get("CLICKHOUSE_TESTS_JSON_PARAMS_PATH") + + params = json.loads(open(params_path, "r").read()) + runner = ClickhouseTestFlowsTestsRunner(result_path, params) + + logging.info("Running tests") + runner.run_impl(repo_path, build_path) + logging.info("Tests finished") diff --git a/tests/testflows/datetime64_extended_range/configs/clickhouse/common.xml b/tests/testflows/datetime64_extended_range/configs/clickhouse/common.xml new file mode 100644 index 00000000000..31fa972199f --- /dev/null +++ b/tests/testflows/datetime64_extended_range/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + 0.0.0.0 + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/datetime64_extended_range/configs/clickhouse/config.xml b/tests/testflows/datetime64_extended_range/configs/clickhouse/config.xml new file mode 100644 index 00000000000..a9a37875273 --- /dev/null +++ b/tests/testflows/datetime64_extended_range/configs/clickhouse/config.xml @@ -0,0 +1,436 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + /var/lib/clickhouse/access/ + + + users.xml + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/datetime64_extended_range/configs/clickhouse/users.xml b/tests/testflows/datetime64_extended_range/configs/clickhouse/users.xml new file mode 100644 index 00000000000..c7d0ecae693 --- /dev/null +++ b/tests/testflows/datetime64_extended_range/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/clickhouse-service.yml b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/clickhouse-service.yml index 0c9352dbc0b..532ce918573 100644 --- a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/clickhouse-service.yml +++ b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/clickhouse-service.yml @@ -2,25 +2,31 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 + init: true expose: - "9000" - "9009" - "8123" volumes: - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.d/:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/ssl:/etc/clickhouse-server/ssl" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/common.xml:/etc/clickhouse-server/common.xml" - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" - entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + entrypoint: bash -c "tail -f /dev/null" healthcheck: - test: clickhouse client --query='select 1' + test: echo 1 interval: 10s timeout: 10s - retries: 10 + retries: 3 start_period: 300s cap_add: - SYS_PTRACE diff --git a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/docker-compose.yml b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/docker-compose.yml index 665e355d51e..83f4a2afab1 100644 --- a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/docker-compose.yml +++ b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/docker-compose.yml @@ -14,8 +14,13 @@ services: volumes: - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/files/:/var/lib/ch-files/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" depends_on: zookeeper: condition: service_healthy @@ -28,8 +33,12 @@ services: volumes: - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/database/:/var/lib/clickhouse/" - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/logs/:/var/log/clickhouse-server/" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" depends_on: zookeeper: condition: service_healthy @@ -42,14 +51,18 @@ services: volumes: - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/database/:/var/lib/clickhouse/" - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/logs/:/var/log/clickhouse-server/" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" depends_on: zookeeper: condition: service_healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/zookeeper-service.yml b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/zookeeper-service.yml index f27405b97a2..60c0e4e7de3 100644 --- a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/zookeeper-service.yml +++ b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.6.2 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/clickhouse-service.yml b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/clickhouse-service.yml new file mode 100644 index 00000000000..a73d31421c8 --- /dev/null +++ b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/clickhouse-service.yml @@ -0,0 +1,29 @@ +version: '2.3' + +services: + clickhouse: + image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:21.12 + privileged: true + expose: + - "9000" + - "9009" + - "8123" + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d:/etc/clickhouse-server/config.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.d/:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/ssl:/etc/clickhouse-server/ssl" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" + - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" + entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + healthcheck: + test: clickhouse client --query='select 1' + interval: 10s + timeout: 10s + retries: 10 + start_period: 300s + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/docker-compose.yml b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/docker-compose.yml new file mode 100644 index 00000000000..03787c14f44 --- /dev/null +++ b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/docker-compose.yml @@ -0,0 +1,62 @@ +version: '2.3' + +services: + zookeeper: + extends: + file: zookeeper-service.yml + service: zookeeper + + clickhouse1: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/files/:/var/lib/ch-files/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/config.d:/etc/clickhouse-server/config.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/users.d:/etc/clickhouse-server/users.d" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse2: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse2 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/config.d:/etc/clickhouse-server/config.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/users.d:/etc/clickhouse-server/users.d" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse3: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse3 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/config.d:/etc/clickhouse-server/config.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/users.d:/etc/clickhouse-server/users.d" + depends_on: + zookeeper: + condition: service_healthy + + all_services_ready: + image: ${IMAGE_DEPENDENCY_PROXY}hello-world + depends_on: + clickhouse1: + condition: service_healthy + clickhouse2: + condition: service_healthy + clickhouse3: + condition: service_healthy + zookeeper: + condition: service_healthy diff --git a/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/zookeeper-service.yml b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/zookeeper-service.yml new file mode 100644 index 00000000000..60c0e4e7de3 --- /dev/null +++ b/tests/testflows/datetime64_extended_range/datetime64_extended_range_env_arm64/zookeeper-service.yml @@ -0,0 +1,18 @@ +version: '2.3' + +services: + zookeeper: + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 + expose: + - "2181" + environment: + ZOO_TICK_TIME: 500 + ZOO_MY_ID: 1 + healthcheck: + test: echo stat | nc localhost 2181 + interval: 3s + timeout: 2s + retries: 5 + start_period: 2s + security_opt: + - label:disable diff --git a/tests/testflows/datetime64_extended_range/regression.py b/tests/testflows/datetime64_extended_range/regression.py index 69c4021df4c..b1f1e22e2c1 100755 --- a/tests/testflows/datetime64_extended_range/regression.py +++ b/tests/testflows/datetime64_extended_range/regression.py @@ -9,6 +9,7 @@ from helpers.argparser import argparser from datetime64_extended_range.requirements import * from datetime64_extended_range.common import * +from datetime64_extended_range.requirements import RQ_SRS_010_DateTime64_ExtendedRange # cross-outs # https://github.com/ClickHouse/ClickHouse/issues/16581#issuecomment-804360350: 128 and 256-bit types are not supported for now @@ -23,6 +24,7 @@ # https://github.com/ClickHouse/ClickHouse/issues/22930 : toWeek() # https://github.com/ClickHouse/ClickHouse/issues/22948 : toYearWeek() # https://github.com/ClickHouse/ClickHouse/issues/22959 : toUnixTimestamp64*() wrong fractal seconds treatment +# https://github.com/ClickHouse/ClickHouse/issues/34831 : DateTime64 to Arrow format mistreats negative timestamps # For `reference times` test it is unclear how to evaluate correctness - majority of test cases are correct, and ONLY # Juba and Monrovia timezones are damaged - probably, due to wrong DST shifts lookup tables @@ -85,38 +87,52 @@ "type conversion/from unix timestamp64 */:": [ (Fail, "https://github.com/ClickHouse/ClickHouse/issues/22959") ], - "type conversion/to int 8 16 32 64 128 256/:": [ - ( - Fail, - "https://github.com/ClickHouse/ClickHouse/issues/16581#issuecomment-804360350", - ) - ], "reference times/:": [(Fail, "check procedure unclear")], - # need to investigate - "type conversion/to datetime/cast=True": [(Fail, "need to investigate")], - "date time funcs/today": [(Fail, "need to investigate")], + "generic/transform/:": [ + (Fail, "https://github.com/ClickHouse/ClickHouse/issues/32387") + ], + "format conversion/arrow format/:": [ + (Fail, "https://github.com/ClickHouse/ClickHouse/issues/34831") + ], + "type conversion/to datetime/:": [(Fail, "needs to be investigated")], +} + +ffails = { + "type conversion/to date32/:": ( + XFail, + "toDate32 not implemented before 21.10", + (lambda test: check_clickhouse_version("<21.10")(test)), + ) } @TestModule @Name("datetime64 extended range") @ArgumentParser(argparser) -@Specifications(SRS_010_ClickHouse_DateTime64_Extended_Range) +@Specifications(QA_SRS010_ClickHouse_DateTime64_Extended_Range) @Requirements( RQ_SRS_010_DateTime64_ExtendedRange("1.0"), ) @XFails(xfails) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=False -): +@FFails(ffails) +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=False): """ClickHouse DateTime64 Extended Range regression module.""" nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), } + self.context.clickhouse_version = clickhouse_version + if stress is not None: self.context.stress = stress - self.context.clickhouse_version = clickhouse_version + + from platform import processor as current_cpu + + folder_name = os.path.basename(current_dir()) + if current_cpu() == "aarch64": + env = f"{folder_name}_env_arm64" + else: + env = f"{folder_name}_env" with Cluster( local, @@ -166,6 +182,14 @@ def regression( parallel=True, executor=pool, ) + Scenario( + run=load( + "datetime64_extended_range.tests.format_conversion", + "format_conversion", + ), + parallel=True, + executor=pool, + ) finally: join() diff --git a/tests/testflows/datetime64_extended_range/requirements/requirements.md b/tests/testflows/datetime64_extended_range/requirements/requirements.md index 659057ebfdc..1430cb2ddfb 100644 --- a/tests/testflows/datetime64_extended_range/requirements/requirements.md +++ b/tests/testflows/datetime64_extended_range/requirements/requirements.md @@ -1,6 +1,24 @@ -# SRS-010 ClickHouse DateTime64 Extended Range +# QA-SRS010 ClickHouse DateTime64 Extended Range # Software Requirements Specification +(c) 2020 Altinity LTD. All Rights Reserved. + +**Document status:** Confidential + +**Author:** vzakaznikov, zvonand + +**Date:** August 10, 2020 + +## Approval + +**Status:** - + +**Version:** - + +**Approved by:** - + +**Date:** - + ## Table of Contents * 1 [Revision History](#revision-history) @@ -22,98 +40,101 @@ * 4.1.0.9 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime](#rqsrs-010datetime64extendedrangenonexistenttime) * 4.1.0.10 [RQ.SRS-010.DateTime64.ExtendedRange.Comparison](#rqsrs-010datetime64extendedrangecomparison) * 4.1.0.11 [RQ.SRS-010.DateTime64.ExtendedRange.SpecificTimestamps](#rqsrs-010datetime64extendedrangespecifictimestamps) + * 4.1.0.12 [RQ.SRS-010.DateTime64.ExtendedRange.Transform](#rqsrs-010datetime64extendedrangetransform) * 4.2 [Specific](#specific) - * 4.2.0.1 [RQ.SRS-010.DateTime64.ExtendedRange.Start](#rqsrs-010datetime64extendedrangestart) - * 4.2.0.2 [RQ.SRS-010.DateTime64.ExtendedRange.End](#rqsrs-010datetime64extendedrangeend) - * 4.2.0.3 [Non-Existent Time](#non-existent-time) - * 4.2.0.3.1 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidDate](#rqsrs-010datetime64extendedrangenonexistenttimeinvaliddate) - * 4.2.0.3.2 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidTime](#rqsrs-010datetime64extendedrangenonexistenttimeinvalidtime) - * 4.2.0.3.3 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.TimeZoneSwitch](#rqsrs-010datetime64extendedrangenonexistenttimetimezoneswitch) - * 4.2.0.3.4 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtime) - * 4.2.0.3.5 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime.Disappeared](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtimedisappeared) - * 4.2.0.3.6 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.LeapSeconds](#rqsrs-010datetime64extendedrangenonexistenttimeleapseconds) - * 4.2.0.4 [Dates And Times Functions](#dates-and-times-functions) - * 4.2.0.4.1 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTimeZone](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotimezone) - * 4.2.0.4.2 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyear) - * 4.2.0.4.3 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoquarter) - * 4.2.0.4.4 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonth) - * 4.2.0.4.5 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofyear) - * 4.2.0.4.6 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofmonth) - * 4.2.0.4.7 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofweek) - * 4.2.0.4.8 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstohour) - * 4.2.0.4.9 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstominute) - * 4.2.0.4.10 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstosecond) - * 4.2.0.4.11 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toUnixTimestamp](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstounixtimestamp) - * 4.2.0.4.12 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofyear) - * 4.2.0.4.13 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofisoyear) - * 4.2.0.4.14 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofquarter) - * 4.2.0.4.15 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofmonth) - * 4.2.0.4.16 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonday) - * 4.2.0.4.17 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofweek) - * 4.2.0.4.18 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfDay](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofday) - * 4.2.0.4.19 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofhour) - * 4.2.0.4.20 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofminute) - * 4.2.0.4.21 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofsecond) - * 4.2.0.4.22 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFiveMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffiveminute) - * 4.2.0.4.23 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfTenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoftenminutes) - * 4.2.0.4.24 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFifteenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffifteenminutes) - * 4.2.0.4.25 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfInterval](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofinterval) - * 4.2.0.4.26 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotime) - * 4.2.0.4.27 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeYearNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeyearnum) - * 4.2.0.4.28 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeQuarterNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativequarternum) - * 4.2.0.4.29 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMonthNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativemonthnum) - * 4.2.0.4.30 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeWeekNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeweeknum) - * 4.2.0.4.31 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeDayNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativedaynum) - * 4.2.0.4.32 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeHourNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativehournum) - * 4.2.0.4.33 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMinuteNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeminutenum) - * 4.2.0.4.34 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeSecondNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativesecondnum) - * 4.2.0.4.35 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoyear) - * 4.2.0.4.36 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoweek) - * 4.2.0.4.37 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoweek) - * 4.2.0.4.38 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYearWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyearweek) - * 4.2.0.4.39 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.now](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsnow) - * 4.2.0.4.40 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.today](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoday) - * 4.2.0.4.41 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.yesterday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsyesterday) - * 4.2.0.4.42 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlot](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslot) - * 4.2.0.4.43 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMM](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymm) - * 4.2.0.4.44 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDD](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmdd) - * 4.2.0.4.45 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDDhhmmss](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmddhhmmss) - * 4.2.0.4.46 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddyears) - * 4.2.0.4.47 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddmonths) - * 4.2.0.4.48 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddweeks) - * 4.2.0.4.49 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsadddays) - * 4.2.0.4.50 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddhours) - * 4.2.0.4.51 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddminutes) - * 4.2.0.4.52 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddseconds) - * 4.2.0.4.53 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddquarters) - * 4.2.0.4.54 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractyears) - * 4.2.0.4.55 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractmonths) - * 4.2.0.4.56 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractweeks) - * 4.2.0.4.57 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractdays) - * 4.2.0.4.58 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtracthours) - * 4.2.0.4.59 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractminutes) - * 4.2.0.4.60 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractseconds) - * 4.2.0.4.61 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractquarters) - * 4.2.0.4.62 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.dateDiff](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsdatediff) - * 4.2.0.4.63 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlots](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslots) - * 4.2.0.4.64 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.formatDateTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsformatdatetime) + * 4.2.0.1 [RQ.SRS-010.DateTime64.ExtendedRange.ArrowFormat](#rqsrs-010datetime64extendedrangearrowformat) + * 4.2.0.2 [RQ.SRS-010.DateTime64.ExtendedRange.Start](#rqsrs-010datetime64extendedrangestart) + * 4.2.0.3 [RQ.SRS-010.DateTime64.ExtendedRange.End](#rqsrs-010datetime64extendedrangeend) + * 4.2.0.4 [Non-Existent Time](#non-existent-time) + * 4.2.0.4.1 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidDate](#rqsrs-010datetime64extendedrangenonexistenttimeinvaliddate) + * 4.2.0.4.2 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidTime](#rqsrs-010datetime64extendedrangenonexistenttimeinvalidtime) + * 4.2.0.4.3 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.TimeZoneSwitch](#rqsrs-010datetime64extendedrangenonexistenttimetimezoneswitch) + * 4.2.0.4.4 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtime) + * 4.2.0.4.5 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime.Disappeared](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtimedisappeared) + * 4.2.0.4.6 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.LeapSeconds](#rqsrs-010datetime64extendedrangenonexistenttimeleapseconds) + * 4.2.0.5 [Dates And Times Functions](#dates-and-times-functions) + * 4.2.0.5.1 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTimeZone](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotimezone) + * 4.2.0.5.2 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyear) + * 4.2.0.5.3 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoquarter) + * 4.2.0.5.4 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonth) + * 4.2.0.5.5 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofyear) + * 4.2.0.5.6 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofmonth) + * 4.2.0.5.7 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofweek) + * 4.2.0.5.8 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstohour) + * 4.2.0.5.9 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstominute) + * 4.2.0.5.10 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstosecond) + * 4.2.0.5.11 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toUnixTimestamp](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstounixtimestamp) + * 4.2.0.5.12 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofyear) + * 4.2.0.5.13 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofisoyear) + * 4.2.0.5.14 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofquarter) + * 4.2.0.5.15 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofmonth) + * 4.2.0.5.16 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonday) + * 4.2.0.5.17 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofweek) + * 4.2.0.5.18 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfDay](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofday) + * 4.2.0.5.19 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofhour) + * 4.2.0.5.20 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofminute) + * 4.2.0.5.21 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofsecond) + * 4.2.0.5.22 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFiveMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffiveminute) + * 4.2.0.5.23 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfTenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoftenminutes) + * 4.2.0.5.24 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFifteenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffifteenminutes) + * 4.2.0.5.25 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfInterval](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofinterval) + * 4.2.0.5.26 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotime) + * 4.2.0.5.27 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeYearNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeyearnum) + * 4.2.0.5.28 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeQuarterNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativequarternum) + * 4.2.0.5.29 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMonthNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativemonthnum) + * 4.2.0.5.30 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeWeekNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeweeknum) + * 4.2.0.5.31 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeDayNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativedaynum) + * 4.2.0.5.32 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeHourNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativehournum) + * 4.2.0.5.33 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMinuteNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeminutenum) + * 4.2.0.5.34 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeSecondNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativesecondnum) + * 4.2.0.5.35 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoyear) + * 4.2.0.5.36 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoweek) + * 4.2.0.5.37 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoweek) + * 4.2.0.5.38 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYearWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyearweek) + * 4.2.0.5.39 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.now](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsnow) + * 4.2.0.5.40 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.today](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoday) + * 4.2.0.5.41 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.yesterday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsyesterday) + * 4.2.0.5.42 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlot](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslot) + * 4.2.0.5.43 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMM](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymm) + * 4.2.0.5.44 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDD](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmdd) + * 4.2.0.5.45 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDDhhmmss](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmddhhmmss) + * 4.2.0.5.46 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddyears) + * 4.2.0.5.47 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddmonths) + * 4.2.0.5.48 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddweeks) + * 4.2.0.5.49 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsadddays) + * 4.2.0.5.50 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddhours) + * 4.2.0.5.51 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddminutes) + * 4.2.0.5.52 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddseconds) + * 4.2.0.5.53 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddquarters) + * 4.2.0.5.54 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractyears) + * 4.2.0.5.55 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractmonths) + * 4.2.0.5.56 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractweeks) + * 4.2.0.5.57 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractdays) + * 4.2.0.5.58 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtracthours) + * 4.2.0.5.59 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractminutes) + * 4.2.0.5.60 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractseconds) + * 4.2.0.5.61 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractquarters) + * 4.2.0.5.62 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.dateDiff](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsdatediff) + * 4.2.0.5.63 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlots](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslots) + * 4.2.0.5.64 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.formatDateTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsformatdatetime) * 4.2.1 [Type Conversion Functions](#type-conversion-functions) - * 4.2.1.4.1 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toInt(8|16|32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstoint8163264128256) - * 4.2.1.4.2 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUInt(8|16|32|64|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstouint8163264256) - * 4.2.1.4.3 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toFloat(32|64)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstofloat3264) - * 4.2.1.4.4 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodate) - * 4.2.1.4.5 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime) - * 4.2.1.4.6 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64) - * 4.2.1.4.7 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64.FromString.MissingTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64fromstringmissingtime) - * 4.2.1.4.8 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDecimal(32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodecimal3264128256) - * 4.2.1.4.9 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toString](#rqsrs-010datetime64extendedrangetypeconversionfunctionstostring) - * 4.2.1.4.10 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.CAST(x,T)](#rqsrs-010datetime64extendedrangetypeconversionfunctionscastxt) - * 4.2.1.4.11 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64milli) - * 4.2.1.4.12 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64micro) - * 4.2.1.4.13 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64nano) - * 4.2.1.4.14 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64milli) - * 4.2.1.4.15 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64micro) - * 4.2.1.4.16 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64nano) + * 4.2.1.5.1 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toInt(8|16|32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstoint8163264128256) + * 4.2.1.5.2 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUInt(8|16|32|64|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstouint8163264256) + * 4.2.1.5.3 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toFloat(32|64)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstofloat3264) + * 4.2.1.5.4 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodate) + * 4.2.1.5.5 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate32](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodate32) + * 4.2.1.5.6 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime) + * 4.2.1.5.7 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64) + * 4.2.1.5.8 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64.FromString.MissingTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64fromstringmissingtime) + * 4.2.1.5.9 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDecimal(32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodecimal3264128256) + * 4.2.1.5.10 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toString](#rqsrs-010datetime64extendedrangetypeconversionfunctionstostring) + * 4.2.1.5.11 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.CAST(x,T)](#rqsrs-010datetime64extendedrangetypeconversionfunctionscastxt) + * 4.2.1.5.12 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64milli) + * 4.2.1.5.13 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64micro) + * 4.2.1.5.14 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64nano) + * 4.2.1.5.15 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64milli) + * 4.2.1.5.16 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64micro) + * 4.2.1.5.17 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64nano) * 5 [References](#references) ## Revision History @@ -210,9 +231,20 @@ version: 1.0 [9961200,73476000,325666800,354675600,370400400,386125200,388566010,401850000,417574811,496803600,528253200,624423614,636516015,671011200,717555600,752047218,859683600,922582800,1018173600,1035705600,1143334800,1162105223,1174784400,1194156000,1206838823,1224982823,1236495624,1319936400,1319936424,1425798025,1459040400,1509872400,2090451627,2140668000] ``` +##### RQ.SRS-010.DateTime64.ExtendedRange.Transform +version: 1.0 + +[ClickHouse] SHALL support `DateTime64` in [`transform`](https://clickhouse.com/docs/ru/sql-reference/functions/other-functions/#transform). ### Specific +##### RQ.SRS-010.DateTime64.ExtendedRange.ArrowFormat +version: 1.0 + +[ClickHouse] SHALL support exporting of [DateTime64] data type to +[Arrow](https://clickhouse.com/docs/en/interfaces/formats/#data-format-arrow) format and importing +[DateTime64] from corresponding Arrow data types. + ##### RQ.SRS-010.DateTime64.ExtendedRange.Start version: 1.0 @@ -705,6 +737,11 @@ version: 1.0 to the [Date](https://clickhouse.com/docs/en/sql-reference/data-types/date/) type using the [toDate](https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions/#todate) function. This function is ONLY supposed to work in NORMAL RANGE. +###### RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate32 +version: 1.0 + +[ClickHouse] SHALL support correct conversion of the [DateTime64] data type to the [Date32](https://clickhouse.com/docs/en/sql-reference/data-types/date32/) type using the [toDate32](https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions/#todate32) function. + ###### RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime version: 1.0 @@ -788,8 +825,8 @@ using the [fromUnixTimestamp64Nano](https://clickhouse.com/docs/en/sql-reference * **DateTime64**: https://clickhouse.com/docs/en/sql-reference/data-types/datetime64/ * **ISO 8601 format**: https://en.wikipedia.org/wiki/ISO_8601 * **ClickHouse:** https://clickhouse.com -* **GitHub Repository:** https://github.com/ClickHouse/ClickHouse/blob/master/tests/testflows/datetime64_extended_range/requirements/requirements.md -* **Revision History:** https://github.com/ClickHouse/ClickHouse/commits/master/tests/testflows/datetime64_extended_range/requirements/requirements.md +* **GitLab Repository:** https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/blob/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md +* **Revision History:** https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/commits/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md * **Git:** https://git-scm.com/ [SRS]: #srs @@ -799,7 +836,7 @@ using the [fromUnixTimestamp64Nano](https://clickhouse.com/docs/en/sql-reference [DateTime64]: https://clickhouse.com/docs/en/sql-reference/data-types/datetime64/ [ISO 8601 format]: https://en.wikipedia.org/wiki/ISO_8601 [ClickHouse]: https://clickhouse.com -[GitHub Repository]: https://github.com/ClickHouse/ClickHouse/blob/master/tests/testflows/datetime64_extended_range/requirements/requirements.md -[Revision History]: https://github.com/ClickHouse/ClickHouse/commits/master/tests/testflows/datetime64_extended_range/requirements/requirements.md +[GitLab Repository]: https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/blob/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md +[Revision History]: https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/commits/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md [Git]: https://git-scm.com/ -[GitHub]: https://github.com +[GitLab]: https://gitlab.com diff --git a/tests/testflows/datetime64_extended_range/requirements/requirements.py b/tests/testflows/datetime64_extended_range/requirements/requirements.py index 1bbaf3547d9..9ad8d8f38c6 100644 --- a/tests/testflows/datetime64_extended_range/requirements/requirements.py +++ b/tests/testflows/datetime64_extended_range/requirements/requirements.py @@ -1,6 +1,6 @@ # These requirements were auto generated # from software requirements specification (SRS) -# document by TestFlows v1.6.210505.1133630. +# document by TestFlows v1.8.220216.1232941. # Do not edit by hand but re-generate instead # using 'tfs requirements generate' command. from testflows.core import Specification @@ -188,13 +188,46 @@ "[9961200,73476000,325666800,354675600,370400400,386125200,388566010,401850000,417574811,496803600,528253200,624423614,636516015,671011200,717555600,752047218,859683600,922582800,1018173600,1035705600,1143334800,1162105223,1174784400,1194156000,1206838823,1224982823,1236495624,1319936400,1319936424,1425798025,1459040400,1509872400,2090451627,2140668000]\n" "```\n" "\n" - "\n" ), link=None, level=4, num="4.1.0.11", ) +RQ_SRS_010_DateTime64_ExtendedRange_Transform = Requirement( + name="RQ.SRS-010.DateTime64.ExtendedRange.Transform", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support `DateTime64` in [`transform`](https://clickhouse.com/docs/ru/sql-reference/functions/other-functions/#transform).\n" + "\n" + ), + link=None, + level=4, + num="4.1.0.12", +) + +RQ_SRS_010_DateTime64_ExtendedRange_ArrowFormat = Requirement( + name="RQ.SRS-010.DateTime64.ExtendedRange.ArrowFormat", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support exporting of [DateTime64] data type to \n" + "[Arrow](https://clickhouse.com/docs/en/interfaces/formats/#data-format-arrow) format and importing \n" + "[DateTime64] from corresponding Arrow data types.\n" + "\n" + ), + link=None, + level=4, + num="4.2.0.1", +) + RQ_SRS_010_DateTime64_ExtendedRange_Start = Requirement( name="RQ.SRS-010.DateTime64.ExtendedRange.Start", version="1.0", @@ -209,7 +242,7 @@ ), link=None, level=4, - num="4.2.0.1", + num="4.2.0.2", ) RQ_SRS_010_DateTime64_ExtendedRange_End = Requirement( @@ -226,7 +259,7 @@ ), link=None, level=4, - num="4.2.0.2", + num="4.2.0.3", ) RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime_InvalidDate = Requirement( @@ -246,7 +279,7 @@ ), link=None, level=5, - num="4.2.0.3.1", + num="4.2.0.4.1", ) RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime_InvalidTime = Requirement( @@ -266,7 +299,7 @@ ), link=None, level=5, - num="4.2.0.3.2", + num="4.2.0.4.2", ) RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime_TimeZoneSwitch = Requirement( @@ -294,7 +327,7 @@ ), link=None, level=5, - num="4.2.0.3.3", + num="4.2.0.4.3", ) RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime_DaylightSavingTime = Requirement( @@ -318,7 +351,7 @@ ), link=None, level=5, - num="4.2.0.3.4", + num="4.2.0.4.4", ) RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime_DaylightSavingTime_Disappeared = Requirement( @@ -337,7 +370,7 @@ ), link=None, level=5, - num="4.2.0.3.5", + num="4.2.0.4.5", ) RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime_LeapSeconds = Requirement( @@ -353,7 +386,7 @@ ), link=None, level=5, - num="4.2.0.3.6", + num="4.2.0.4.6", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toTimeZone = Requirement( @@ -370,7 +403,7 @@ ), link=None, level=5, - num="4.2.0.4.1", + num="4.2.0.5.1", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toYear = Requirement( @@ -387,7 +420,7 @@ ), link=None, level=5, - num="4.2.0.4.2", + num="4.2.0.5.2", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toQuarter = Requirement( @@ -404,7 +437,7 @@ ), link=None, level=5, - num="4.2.0.4.3", + num="4.2.0.5.3", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toMonth = Requirement( @@ -421,7 +454,7 @@ ), link=None, level=5, - num="4.2.0.4.4", + num="4.2.0.5.4", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toDayOfYear = Requirement( @@ -438,7 +471,7 @@ ), link=None, level=5, - num="4.2.0.4.5", + num="4.2.0.5.5", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toDayOfMonth = Requirement( @@ -455,7 +488,7 @@ ), link=None, level=5, - num="4.2.0.4.6", + num="4.2.0.5.6", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toDayOfWeek = Requirement( @@ -472,7 +505,7 @@ ), link=None, level=5, - num="4.2.0.4.7", + num="4.2.0.5.7", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toHour = Requirement( @@ -489,7 +522,7 @@ ), link=None, level=5, - num="4.2.0.4.8", + num="4.2.0.5.8", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toMinute = Requirement( @@ -506,7 +539,7 @@ ), link=None, level=5, - num="4.2.0.4.9", + num="4.2.0.5.9", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toSecond = Requirement( @@ -523,7 +556,7 @@ ), link=None, level=5, - num="4.2.0.4.10", + num="4.2.0.5.10", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toUnixTimestamp = Requirement( @@ -541,7 +574,7 @@ ), link=None, level=5, - num="4.2.0.4.11", + num="4.2.0.5.11", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfYear = Requirement( @@ -558,7 +591,7 @@ ), link=None, level=5, - num="4.2.0.4.12", + num="4.2.0.5.12", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfISOYear = Requirement( @@ -575,7 +608,7 @@ ), link=None, level=5, - num="4.2.0.4.13", + num="4.2.0.5.13", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfQuarter = Requirement( @@ -592,7 +625,7 @@ ), link=None, level=5, - num="4.2.0.4.14", + num="4.2.0.5.14", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfMonth = Requirement( @@ -609,7 +642,7 @@ ), link=None, level=5, - num="4.2.0.4.15", + num="4.2.0.5.15", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toMonday = Requirement( @@ -626,7 +659,7 @@ ), link=None, level=5, - num="4.2.0.4.16", + num="4.2.0.5.16", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfWeek = Requirement( @@ -643,7 +676,7 @@ ), link=None, level=5, - num="4.2.0.4.17", + num="4.2.0.5.17", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfDay = Requirement( @@ -660,7 +693,7 @@ ), link=None, level=5, - num="4.2.0.4.18", + num="4.2.0.5.18", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfHour = Requirement( @@ -677,7 +710,7 @@ ), link=None, level=5, - num="4.2.0.4.19", + num="4.2.0.5.19", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfMinute = Requirement( @@ -694,7 +727,7 @@ ), link=None, level=5, - num="4.2.0.4.20", + num="4.2.0.5.20", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfSecond = Requirement( @@ -711,7 +744,7 @@ ), link=None, level=5, - num="4.2.0.4.21", + num="4.2.0.5.21", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfFiveMinute = Requirement( @@ -728,7 +761,7 @@ ), link=None, level=5, - num="4.2.0.4.22", + num="4.2.0.5.22", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfTenMinutes = Requirement( @@ -745,7 +778,7 @@ ), link=None, level=5, - num="4.2.0.4.23", + num="4.2.0.5.23", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfFifteenMinutes = Requirement( @@ -762,7 +795,7 @@ ), link=None, level=5, - num="4.2.0.4.24", + num="4.2.0.5.24", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toStartOfInterval = Requirement( @@ -780,7 +813,7 @@ ), link=None, level=5, - num="4.2.0.4.25", + num="4.2.0.5.25", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toTime = Requirement( @@ -797,7 +830,7 @@ ), link=None, level=5, - num="4.2.0.4.26", + num="4.2.0.5.26", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeYearNum = Requirement( @@ -814,7 +847,7 @@ ), link=None, level=5, - num="4.2.0.4.27", + num="4.2.0.5.27", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeQuarterNum = Requirement( @@ -831,7 +864,7 @@ ), link=None, level=5, - num="4.2.0.4.28", + num="4.2.0.5.28", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeMonthNum = Requirement( @@ -848,7 +881,7 @@ ), link=None, level=5, - num="4.2.0.4.29", + num="4.2.0.5.29", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeWeekNum = Requirement( @@ -865,7 +898,7 @@ ), link=None, level=5, - num="4.2.0.4.30", + num="4.2.0.5.30", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeDayNum = Requirement( @@ -882,7 +915,7 @@ ), link=None, level=5, - num="4.2.0.4.31", + num="4.2.0.5.31", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeHourNum = Requirement( @@ -899,7 +932,7 @@ ), link=None, level=5, - num="4.2.0.4.32", + num="4.2.0.5.32", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeMinuteNum = Requirement( @@ -916,7 +949,7 @@ ), link=None, level=5, - num="4.2.0.4.33", + num="4.2.0.5.33", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toRelativeSecondNum = Requirement( @@ -933,7 +966,7 @@ ), link=None, level=5, - num="4.2.0.4.34", + num="4.2.0.5.34", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toISOYear = Requirement( @@ -950,7 +983,7 @@ ), link=None, level=5, - num="4.2.0.4.35", + num="4.2.0.5.35", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toISOWeek = Requirement( @@ -967,7 +1000,7 @@ ), link=None, level=5, - num="4.2.0.4.36", + num="4.2.0.5.36", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toWeek = Requirement( @@ -984,7 +1017,7 @@ ), link=None, level=5, - num="4.2.0.4.37", + num="4.2.0.5.37", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toYearWeek = Requirement( @@ -1001,7 +1034,7 @@ ), link=None, level=5, - num="4.2.0.4.38", + num="4.2.0.5.38", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_now = Requirement( @@ -1018,7 +1051,7 @@ ), link=None, level=5, - num="4.2.0.4.39", + num="4.2.0.5.39", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_today = Requirement( @@ -1035,7 +1068,7 @@ ), link=None, level=5, - num="4.2.0.4.40", + num="4.2.0.5.40", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_yesterday = Requirement( @@ -1052,7 +1085,7 @@ ), link=None, level=5, - num="4.2.0.4.41", + num="4.2.0.5.41", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_timeSlot = Requirement( @@ -1069,7 +1102,7 @@ ), link=None, level=5, - num="4.2.0.4.42", + num="4.2.0.5.42", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toYYYYMM = Requirement( @@ -1086,7 +1119,7 @@ ), link=None, level=5, - num="4.2.0.4.43", + num="4.2.0.5.43", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toYYYYMMDD = Requirement( @@ -1103,7 +1136,7 @@ ), link=None, level=5, - num="4.2.0.4.44", + num="4.2.0.5.44", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_toYYYYMMDDhhmmss = Requirement( @@ -1120,7 +1153,7 @@ ), link=None, level=5, - num="4.2.0.4.45", + num="4.2.0.5.45", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addYears = Requirement( @@ -1137,7 +1170,7 @@ ), link=None, level=5, - num="4.2.0.4.46", + num="4.2.0.5.46", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addMonths = Requirement( @@ -1154,7 +1187,7 @@ ), link=None, level=5, - num="4.2.0.4.47", + num="4.2.0.5.47", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addWeeks = Requirement( @@ -1171,7 +1204,7 @@ ), link=None, level=5, - num="4.2.0.4.48", + num="4.2.0.5.48", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addDays = Requirement( @@ -1188,7 +1221,7 @@ ), link=None, level=5, - num="4.2.0.4.49", + num="4.2.0.5.49", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addHours = Requirement( @@ -1205,7 +1238,7 @@ ), link=None, level=5, - num="4.2.0.4.50", + num="4.2.0.5.50", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addMinutes = Requirement( @@ -1222,7 +1255,7 @@ ), link=None, level=5, - num="4.2.0.4.51", + num="4.2.0.5.51", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addSeconds = Requirement( @@ -1239,7 +1272,7 @@ ), link=None, level=5, - num="4.2.0.4.52", + num="4.2.0.5.52", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_addQuarters = Requirement( @@ -1256,7 +1289,7 @@ ), link=None, level=5, - num="4.2.0.4.53", + num="4.2.0.5.53", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractYears = Requirement( @@ -1273,7 +1306,7 @@ ), link=None, level=5, - num="4.2.0.4.54", + num="4.2.0.5.54", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractMonths = Requirement( @@ -1290,7 +1323,7 @@ ), link=None, level=5, - num="4.2.0.4.55", + num="4.2.0.5.55", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractWeeks = Requirement( @@ -1307,7 +1340,7 @@ ), link=None, level=5, - num="4.2.0.4.56", + num="4.2.0.5.56", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractDays = Requirement( @@ -1325,7 +1358,7 @@ ), link=None, level=5, - num="4.2.0.4.57", + num="4.2.0.5.57", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractHours = Requirement( @@ -1342,7 +1375,7 @@ ), link=None, level=5, - num="4.2.0.4.58", + num="4.2.0.5.58", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractMinutes = Requirement( @@ -1359,7 +1392,7 @@ ), link=None, level=5, - num="4.2.0.4.59", + num="4.2.0.5.59", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractSeconds = Requirement( @@ -1376,7 +1409,7 @@ ), link=None, level=5, - num="4.2.0.4.60", + num="4.2.0.5.60", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_subtractQuarters = Requirement( @@ -1393,7 +1426,7 @@ ), link=None, level=5, - num="4.2.0.4.61", + num="4.2.0.5.61", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_dateDiff = Requirement( @@ -1410,7 +1443,7 @@ ), link=None, level=5, - num="4.2.0.4.62", + num="4.2.0.5.62", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_timeSlots = Requirement( @@ -1427,7 +1460,7 @@ ), link=None, level=5, - num="4.2.0.4.63", + num="4.2.0.5.63", ) RQ_SRS_010_DateTime64_ExtendedRange_DatesAndTimesFunctions_formatDateTime = Requirement( @@ -1445,7 +1478,7 @@ ), link=None, level=5, - num="4.2.0.4.64", + num="4.2.0.5.64", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toInt_8_16_32_64_128_256_ = Requirement( @@ -1462,7 +1495,7 @@ ), link=None, level=5, - num="4.2.1.4.1", + num="4.2.1.5.1", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toUInt_8_16_32_64_256_ = Requirement( @@ -1479,7 +1512,7 @@ ), link=None, level=5, - num="4.2.1.4.2", + num="4.2.1.5.2", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toFloat_32_64_ = Requirement( @@ -1496,7 +1529,7 @@ ), link=None, level=5, - num="4.2.1.4.3", + num="4.2.1.5.3", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDate = Requirement( @@ -1514,7 +1547,23 @@ ), link=None, level=5, - num="4.2.1.4.4", + num="4.2.1.5.4", +) + +RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDate32 = Requirement( + name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate32", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support correct conversion of the [DateTime64] data type to the [Date32](https://clickhouse.com/docs/en/sql-reference/data-types/date32/) type using the [toDate32](https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions/#todate32) function.\n" + "\n" + ), + link=None, + level=5, + num="4.2.1.5.5", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDateTime = Requirement( @@ -1532,7 +1581,7 @@ ), link=None, level=5, - num="4.2.1.4.5", + num="4.2.1.5.6", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDateTime64 = Requirement( @@ -1549,7 +1598,7 @@ ), link=None, level=5, - num="4.2.1.4.6", + num="4.2.1.5.7", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDateTime64_FromString_MissingTime = Requirement( @@ -1568,7 +1617,7 @@ ), link=None, level=5, - num="4.2.1.4.7", + num="4.2.1.5.8", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDecimal_32_64_128_256_ = Requirement( @@ -1585,7 +1634,7 @@ ), link=None, level=5, - num="4.2.1.4.8", + num="4.2.1.5.9", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toString = Requirement( @@ -1602,7 +1651,7 @@ ), link=None, level=5, - num="4.2.1.4.9", + num="4.2.1.5.10", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_CAST_x_T_ = Requirement( @@ -1619,7 +1668,7 @@ ), link=None, level=5, - num="4.2.1.4.10", + num="4.2.1.5.11", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toUnixTimestamp64Milli = Requirement( @@ -1636,7 +1685,7 @@ ), link=None, level=5, - num="4.2.1.4.11", + num="4.2.1.5.12", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toUnixTimestamp64Micro = Requirement( @@ -1653,7 +1702,7 @@ ), link=None, level=5, - num="4.2.1.4.12", + num="4.2.1.5.13", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toUnixTimestamp64Nano = Requirement( @@ -1670,7 +1719,7 @@ ), link=None, level=5, - num="4.2.1.4.13", + num="4.2.1.5.14", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_fromUnixTimestamp64Milli = Requirement( @@ -1688,7 +1737,7 @@ ), link=None, level=5, - num="4.2.1.4.14", + num="4.2.1.5.15", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_fromUnixTimestamp64Micro = Requirement( @@ -1706,7 +1755,7 @@ ), link=None, level=5, - num="4.2.1.4.15", + num="4.2.1.5.16", ) RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_fromUnixTimestamp64Nano = Requirement( @@ -1724,18 +1773,18 @@ ), link=None, level=5, - num="4.2.1.4.16", + num="4.2.1.5.17", ) -SRS_010_ClickHouse_DateTime64_Extended_Range = Specification( - name="SRS-010 ClickHouse DateTime64 Extended Range", +QA_SRS010_ClickHouse_DateTime64_Extended_Range = Specification( + name="QA-SRS010 ClickHouse DateTime64 Extended Range", description=None, - author=None, - date=None, - status=None, - approved_by=None, - approved_date=None, - approved_version=None, + author="vzakaznikov, zvonand", + date="August 10, 2020", + status="-", + approved_by="-", + approved_date="-", + approved_version="-", version=None, group=None, type=None, @@ -1801,443 +1850,458 @@ level=4, num="4.1.0.11", ), + Heading( + name="RQ.SRS-010.DateTime64.ExtendedRange.Transform", + level=4, + num="4.1.0.12", + ), Heading(name="Specific", level=2, num="4.2"), Heading( - name="RQ.SRS-010.DateTime64.ExtendedRange.Start", level=4, num="4.2.0.1" + name="RQ.SRS-010.DateTime64.ExtendedRange.ArrowFormat", + level=4, + num="4.2.0.1", ), - Heading(name="RQ.SRS-010.DateTime64.ExtendedRange.End", level=4, num="4.2.0.2"), - Heading(name="Non-Existent Time", level=4, num="4.2.0.3"), + Heading( + name="RQ.SRS-010.DateTime64.ExtendedRange.Start", level=4, num="4.2.0.2" + ), + Heading(name="RQ.SRS-010.DateTime64.ExtendedRange.End", level=4, num="4.2.0.3"), + Heading(name="Non-Existent Time", level=4, num="4.2.0.4"), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidDate", level=5, - num="4.2.0.3.1", + num="4.2.0.4.1", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidTime", level=5, - num="4.2.0.3.2", + num="4.2.0.4.2", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.TimeZoneSwitch", level=5, - num="4.2.0.3.3", + num="4.2.0.4.3", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime", level=5, - num="4.2.0.3.4", + num="4.2.0.4.4", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime.Disappeared", level=5, - num="4.2.0.3.5", + num="4.2.0.4.5", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.LeapSeconds", level=5, - num="4.2.0.3.6", + num="4.2.0.4.6", ), - Heading(name="Dates And Times Functions", level=4, num="4.2.0.4"), + Heading(name="Dates And Times Functions", level=4, num="4.2.0.5"), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTimeZone", level=5, - num="4.2.0.4.1", + num="4.2.0.5.1", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYear", level=5, - num="4.2.0.4.2", + num="4.2.0.5.2", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toQuarter", level=5, - num="4.2.0.4.3", + num="4.2.0.5.3", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonth", level=5, - num="4.2.0.4.4", + num="4.2.0.5.4", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfYear", level=5, - num="4.2.0.4.5", + num="4.2.0.5.5", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfMonth", level=5, - num="4.2.0.4.6", + num="4.2.0.5.6", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfWeek", level=5, - num="4.2.0.4.7", + num="4.2.0.5.7", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toHour", level=5, - num="4.2.0.4.8", + num="4.2.0.5.8", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMinute", level=5, - num="4.2.0.4.9", + num="4.2.0.5.9", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toSecond", level=5, - num="4.2.0.4.10", + num="4.2.0.5.10", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toUnixTimestamp", level=5, - num="4.2.0.4.11", + num="4.2.0.5.11", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfYear", level=5, - num="4.2.0.4.12", + num="4.2.0.5.12", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfISOYear", level=5, - num="4.2.0.4.13", + num="4.2.0.5.13", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfQuarter", level=5, - num="4.2.0.4.14", + num="4.2.0.5.14", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMonth", level=5, - num="4.2.0.4.15", + num="4.2.0.5.15", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonday", level=5, - num="4.2.0.4.16", + num="4.2.0.5.16", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfWeek", level=5, - num="4.2.0.4.17", + num="4.2.0.5.17", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfDay", level=5, - num="4.2.0.4.18", + num="4.2.0.5.18", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfHour", level=5, - num="4.2.0.4.19", + num="4.2.0.5.19", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMinute", level=5, - num="4.2.0.4.20", + num="4.2.0.5.20", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfSecond", level=5, - num="4.2.0.4.21", + num="4.2.0.5.21", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFiveMinute", level=5, - num="4.2.0.4.22", + num="4.2.0.5.22", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfTenMinutes", level=5, - num="4.2.0.4.23", + num="4.2.0.5.23", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFifteenMinutes", level=5, - num="4.2.0.4.24", + num="4.2.0.5.24", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfInterval", level=5, - num="4.2.0.4.25", + num="4.2.0.5.25", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTime", level=5, - num="4.2.0.4.26", + num="4.2.0.5.26", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeYearNum", level=5, - num="4.2.0.4.27", + num="4.2.0.5.27", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeQuarterNum", level=5, - num="4.2.0.4.28", + num="4.2.0.5.28", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMonthNum", level=5, - num="4.2.0.4.29", + num="4.2.0.5.29", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeWeekNum", level=5, - num="4.2.0.4.30", + num="4.2.0.5.30", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeDayNum", level=5, - num="4.2.0.4.31", + num="4.2.0.5.31", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeHourNum", level=5, - num="4.2.0.4.32", + num="4.2.0.5.32", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMinuteNum", level=5, - num="4.2.0.4.33", + num="4.2.0.5.33", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeSecondNum", level=5, - num="4.2.0.4.34", + num="4.2.0.5.34", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOYear", level=5, - num="4.2.0.4.35", + num="4.2.0.5.35", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOWeek", level=5, - num="4.2.0.4.36", + num="4.2.0.5.36", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toWeek", level=5, - num="4.2.0.4.37", + num="4.2.0.5.37", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYearWeek", level=5, - num="4.2.0.4.38", + num="4.2.0.5.38", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.now", level=5, - num="4.2.0.4.39", + num="4.2.0.5.39", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.today", level=5, - num="4.2.0.4.40", + num="4.2.0.5.40", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.yesterday", level=5, - num="4.2.0.4.41", + num="4.2.0.5.41", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlot", level=5, - num="4.2.0.4.42", + num="4.2.0.5.42", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMM", level=5, - num="4.2.0.4.43", + num="4.2.0.5.43", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDD", level=5, - num="4.2.0.4.44", + num="4.2.0.5.44", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDDhhmmss", level=5, - num="4.2.0.4.45", + num="4.2.0.5.45", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addYears", level=5, - num="4.2.0.4.46", + num="4.2.0.5.46", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMonths", level=5, - num="4.2.0.4.47", + num="4.2.0.5.47", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addWeeks", level=5, - num="4.2.0.4.48", + num="4.2.0.5.48", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addDays", level=5, - num="4.2.0.4.49", + num="4.2.0.5.49", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addHours", level=5, - num="4.2.0.4.50", + num="4.2.0.5.50", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMinutes", level=5, - num="4.2.0.4.51", + num="4.2.0.5.51", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addSeconds", level=5, - num="4.2.0.4.52", + num="4.2.0.5.52", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addQuarters", level=5, - num="4.2.0.4.53", + num="4.2.0.5.53", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractYears", level=5, - num="4.2.0.4.54", + num="4.2.0.5.54", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMonths", level=5, - num="4.2.0.4.55", + num="4.2.0.5.55", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractWeeks", level=5, - num="4.2.0.4.56", + num="4.2.0.5.56", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractDays", level=5, - num="4.2.0.4.57", + num="4.2.0.5.57", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractHours", level=5, - num="4.2.0.4.58", + num="4.2.0.5.58", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMinutes", level=5, - num="4.2.0.4.59", + num="4.2.0.5.59", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractSeconds", level=5, - num="4.2.0.4.60", + num="4.2.0.5.60", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractQuarters", level=5, - num="4.2.0.4.61", + num="4.2.0.5.61", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.dateDiff", level=5, - num="4.2.0.4.62", + num="4.2.0.5.62", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlots", level=5, - num="4.2.0.4.63", + num="4.2.0.5.63", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.formatDateTime", level=5, - num="4.2.0.4.64", + num="4.2.0.5.64", ), Heading(name="Type Conversion Functions", level=3, num="4.2.1"), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toInt(8|16|32|64|128|256)", level=5, - num="4.2.1.4.1", + num="4.2.1.5.1", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUInt(8|16|32|64|256)", level=5, - num="4.2.1.4.2", + num="4.2.1.5.2", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toFloat(32|64)", level=5, - num="4.2.1.4.3", + num="4.2.1.5.3", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate", level=5, - num="4.2.1.4.4", + num="4.2.1.5.4", + ), + Heading( + name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate32", + level=5, + num="4.2.1.5.5", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime", level=5, - num="4.2.1.4.5", + num="4.2.1.5.6", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64", level=5, - num="4.2.1.4.6", + num="4.2.1.5.7", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64.FromString.MissingTime", level=5, - num="4.2.1.4.7", + num="4.2.1.5.8", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDecimal(32|64|128|256)", level=5, - num="4.2.1.4.8", + num="4.2.1.5.9", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toString", level=5, - num="4.2.1.4.9", + num="4.2.1.5.10", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.CAST(x,T)", level=5, - num="4.2.1.4.10", + num="4.2.1.5.11", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Milli", level=5, - num="4.2.1.4.11", + num="4.2.1.5.12", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Micro", level=5, - num="4.2.1.4.12", + num="4.2.1.5.13", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Nano", level=5, - num="4.2.1.4.13", + num="4.2.1.5.14", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Milli", level=5, - num="4.2.1.4.14", + num="4.2.1.5.15", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Micro", level=5, - num="4.2.1.4.15", + num="4.2.1.5.16", ), Heading( name="RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Nano", level=5, - num="4.2.1.4.16", + num="4.2.1.5.17", ), Heading(name="References", level=1, num="5"), ), @@ -2253,6 +2317,8 @@ RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime, RQ_SRS_010_DateTime64_ExtendedRange_Comparison, RQ_SRS_010_DateTime64_ExtendedRange_SpecificTimestamps, + RQ_SRS_010_DateTime64_ExtendedRange_Transform, + RQ_SRS_010_DateTime64_ExtendedRange_ArrowFormat, RQ_SRS_010_DateTime64_ExtendedRange_Start, RQ_SRS_010_DateTime64_ExtendedRange_End, RQ_SRS_010_DateTime64_ExtendedRange_NonExistentTime_InvalidDate, @@ -2329,6 +2395,7 @@ RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toUInt_8_16_32_64_256_, RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toFloat_32_64_, RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDate, + RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDate32, RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDateTime, RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDateTime64, RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDateTime64_FromString_MissingTime, @@ -2343,9 +2410,27 @@ RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_fromUnixTimestamp64Nano, ), content=""" -# SRS-010 ClickHouse DateTime64 Extended Range +# QA-SRS010 ClickHouse DateTime64 Extended Range # Software Requirements Specification +(c) 2020 Altinity LTD. All Rights Reserved. + +**Document status:** Confidential + +**Author:** vzakaznikov, zvonand + +**Date:** August 10, 2020 + +## Approval + +**Status:** - + +**Version:** - + +**Approved by:** - + +**Date:** - + ## Table of Contents * 1 [Revision History](#revision-history) @@ -2367,98 +2452,101 @@ * 4.1.0.9 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime](#rqsrs-010datetime64extendedrangenonexistenttime) * 4.1.0.10 [RQ.SRS-010.DateTime64.ExtendedRange.Comparison](#rqsrs-010datetime64extendedrangecomparison) * 4.1.0.11 [RQ.SRS-010.DateTime64.ExtendedRange.SpecificTimestamps](#rqsrs-010datetime64extendedrangespecifictimestamps) + * 4.1.0.12 [RQ.SRS-010.DateTime64.ExtendedRange.Transform](#rqsrs-010datetime64extendedrangetransform) * 4.2 [Specific](#specific) - * 4.2.0.1 [RQ.SRS-010.DateTime64.ExtendedRange.Start](#rqsrs-010datetime64extendedrangestart) - * 4.2.0.2 [RQ.SRS-010.DateTime64.ExtendedRange.End](#rqsrs-010datetime64extendedrangeend) - * 4.2.0.3 [Non-Existent Time](#non-existent-time) - * 4.2.0.3.1 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidDate](#rqsrs-010datetime64extendedrangenonexistenttimeinvaliddate) - * 4.2.0.3.2 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidTime](#rqsrs-010datetime64extendedrangenonexistenttimeinvalidtime) - * 4.2.0.3.3 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.TimeZoneSwitch](#rqsrs-010datetime64extendedrangenonexistenttimetimezoneswitch) - * 4.2.0.3.4 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtime) - * 4.2.0.3.5 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime.Disappeared](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtimedisappeared) - * 4.2.0.3.6 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.LeapSeconds](#rqsrs-010datetime64extendedrangenonexistenttimeleapseconds) - * 4.2.0.4 [Dates And Times Functions](#dates-and-times-functions) - * 4.2.0.4.1 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTimeZone](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotimezone) - * 4.2.0.4.2 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyear) - * 4.2.0.4.3 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoquarter) - * 4.2.0.4.4 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonth) - * 4.2.0.4.5 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofyear) - * 4.2.0.4.6 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofmonth) - * 4.2.0.4.7 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofweek) - * 4.2.0.4.8 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstohour) - * 4.2.0.4.9 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstominute) - * 4.2.0.4.10 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstosecond) - * 4.2.0.4.11 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toUnixTimestamp](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstounixtimestamp) - * 4.2.0.4.12 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofyear) - * 4.2.0.4.13 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofisoyear) - * 4.2.0.4.14 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofquarter) - * 4.2.0.4.15 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofmonth) - * 4.2.0.4.16 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonday) - * 4.2.0.4.17 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofweek) - * 4.2.0.4.18 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfDay](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofday) - * 4.2.0.4.19 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofhour) - * 4.2.0.4.20 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofminute) - * 4.2.0.4.21 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofsecond) - * 4.2.0.4.22 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFiveMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffiveminute) - * 4.2.0.4.23 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfTenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoftenminutes) - * 4.2.0.4.24 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFifteenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffifteenminutes) - * 4.2.0.4.25 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfInterval](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofinterval) - * 4.2.0.4.26 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotime) - * 4.2.0.4.27 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeYearNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeyearnum) - * 4.2.0.4.28 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeQuarterNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativequarternum) - * 4.2.0.4.29 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMonthNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativemonthnum) - * 4.2.0.4.30 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeWeekNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeweeknum) - * 4.2.0.4.31 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeDayNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativedaynum) - * 4.2.0.4.32 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeHourNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativehournum) - * 4.2.0.4.33 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMinuteNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeminutenum) - * 4.2.0.4.34 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeSecondNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativesecondnum) - * 4.2.0.4.35 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoyear) - * 4.2.0.4.36 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoweek) - * 4.2.0.4.37 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoweek) - * 4.2.0.4.38 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYearWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyearweek) - * 4.2.0.4.39 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.now](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsnow) - * 4.2.0.4.40 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.today](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoday) - * 4.2.0.4.41 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.yesterday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsyesterday) - * 4.2.0.4.42 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlot](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslot) - * 4.2.0.4.43 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMM](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymm) - * 4.2.0.4.44 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDD](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmdd) - * 4.2.0.4.45 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDDhhmmss](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmddhhmmss) - * 4.2.0.4.46 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddyears) - * 4.2.0.4.47 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddmonths) - * 4.2.0.4.48 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddweeks) - * 4.2.0.4.49 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsadddays) - * 4.2.0.4.50 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddhours) - * 4.2.0.4.51 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddminutes) - * 4.2.0.4.52 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddseconds) - * 4.2.0.4.53 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddquarters) - * 4.2.0.4.54 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractyears) - * 4.2.0.4.55 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractmonths) - * 4.2.0.4.56 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractweeks) - * 4.2.0.4.57 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractdays) - * 4.2.0.4.58 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtracthours) - * 4.2.0.4.59 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractminutes) - * 4.2.0.4.60 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractseconds) - * 4.2.0.4.61 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractquarters) - * 4.2.0.4.62 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.dateDiff](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsdatediff) - * 4.2.0.4.63 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlots](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslots) - * 4.2.0.4.64 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.formatDateTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsformatdatetime) + * 4.2.0.1 [RQ.SRS-010.DateTime64.ExtendedRange.ArrowFormat](#rqsrs-010datetime64extendedrangearrowformat) + * 4.2.0.2 [RQ.SRS-010.DateTime64.ExtendedRange.Start](#rqsrs-010datetime64extendedrangestart) + * 4.2.0.3 [RQ.SRS-010.DateTime64.ExtendedRange.End](#rqsrs-010datetime64extendedrangeend) + * 4.2.0.4 [Non-Existent Time](#non-existent-time) + * 4.2.0.4.1 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidDate](#rqsrs-010datetime64extendedrangenonexistenttimeinvaliddate) + * 4.2.0.4.2 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.InvalidTime](#rqsrs-010datetime64extendedrangenonexistenttimeinvalidtime) + * 4.2.0.4.3 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.TimeZoneSwitch](#rqsrs-010datetime64extendedrangenonexistenttimetimezoneswitch) + * 4.2.0.4.4 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtime) + * 4.2.0.4.5 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.DaylightSavingTime.Disappeared](#rqsrs-010datetime64extendedrangenonexistenttimedaylightsavingtimedisappeared) + * 4.2.0.4.6 [RQ.SRS-010.DateTime64.ExtendedRange.NonExistentTime.LeapSeconds](#rqsrs-010datetime64extendedrangenonexistenttimeleapseconds) + * 4.2.0.5 [Dates And Times Functions](#dates-and-times-functions) + * 4.2.0.5.1 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTimeZone](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotimezone) + * 4.2.0.5.2 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyear) + * 4.2.0.5.3 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoquarter) + * 4.2.0.5.4 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonth) + * 4.2.0.5.5 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofyear) + * 4.2.0.5.6 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofmonth) + * 4.2.0.5.7 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toDayOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstodayofweek) + * 4.2.0.5.8 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstohour) + * 4.2.0.5.9 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstominute) + * 4.2.0.5.10 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstosecond) + * 4.2.0.5.11 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toUnixTimestamp](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstounixtimestamp) + * 4.2.0.5.12 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofyear) + * 4.2.0.5.13 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofisoyear) + * 4.2.0.5.14 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfQuarter](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofquarter) + * 4.2.0.5.15 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMonth](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofmonth) + * 4.2.0.5.16 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toMonday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstomonday) + * 4.2.0.5.17 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofweek) + * 4.2.0.5.18 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfDay](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofday) + * 4.2.0.5.19 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfHour](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofhour) + * 4.2.0.5.20 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofminute) + * 4.2.0.5.21 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfSecond](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofsecond) + * 4.2.0.5.22 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFiveMinute](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffiveminute) + * 4.2.0.5.23 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfTenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoftenminutes) + * 4.2.0.5.24 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfFifteenMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartoffifteenminutes) + * 4.2.0.5.25 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toStartOfInterval](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstostartofinterval) + * 4.2.0.5.26 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstotime) + * 4.2.0.5.27 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeYearNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeyearnum) + * 4.2.0.5.28 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeQuarterNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativequarternum) + * 4.2.0.5.29 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMonthNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativemonthnum) + * 4.2.0.5.30 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeWeekNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeweeknum) + * 4.2.0.5.31 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeDayNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativedaynum) + * 4.2.0.5.32 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeHourNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativehournum) + * 4.2.0.5.33 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeMinuteNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativeminutenum) + * 4.2.0.5.34 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toRelativeSecondNum](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstorelativesecondnum) + * 4.2.0.5.35 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOYear](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoyear) + * 4.2.0.5.36 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toISOWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoisoweek) + * 4.2.0.5.37 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoweek) + * 4.2.0.5.38 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYearWeek](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyearweek) + * 4.2.0.5.39 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.now](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsnow) + * 4.2.0.5.40 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.today](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoday) + * 4.2.0.5.41 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.yesterday](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsyesterday) + * 4.2.0.5.42 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlot](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslot) + * 4.2.0.5.43 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMM](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymm) + * 4.2.0.5.44 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDD](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmdd) + * 4.2.0.5.45 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.toYYYYMMDDhhmmss](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstoyyyymmddhhmmss) + * 4.2.0.5.46 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddyears) + * 4.2.0.5.47 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddmonths) + * 4.2.0.5.48 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddweeks) + * 4.2.0.5.49 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsadddays) + * 4.2.0.5.50 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddhours) + * 4.2.0.5.51 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddminutes) + * 4.2.0.5.52 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddseconds) + * 4.2.0.5.53 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.addQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsaddquarters) + * 4.2.0.5.54 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractYears](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractyears) + * 4.2.0.5.55 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMonths](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractmonths) + * 4.2.0.5.56 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractWeeks](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractweeks) + * 4.2.0.5.57 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractDays](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractdays) + * 4.2.0.5.58 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractHours](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtracthours) + * 4.2.0.5.59 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractMinutes](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractminutes) + * 4.2.0.5.60 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractSeconds](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractseconds) + * 4.2.0.5.61 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.subtractQuarters](#rqsrs-010datetime64extendedrangedatesandtimesfunctionssubtractquarters) + * 4.2.0.5.62 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.dateDiff](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsdatediff) + * 4.2.0.5.63 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.timeSlots](#rqsrs-010datetime64extendedrangedatesandtimesfunctionstimeslots) + * 4.2.0.5.64 [RQ.SRS-010.DateTime64.ExtendedRange.DatesAndTimesFunctions.formatDateTime](#rqsrs-010datetime64extendedrangedatesandtimesfunctionsformatdatetime) * 4.2.1 [Type Conversion Functions](#type-conversion-functions) - * 4.2.1.4.1 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toInt(8|16|32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstoint8163264128256) - * 4.2.1.4.2 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUInt(8|16|32|64|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstouint8163264256) - * 4.2.1.4.3 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toFloat(32|64)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstofloat3264) - * 4.2.1.4.4 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodate) - * 4.2.1.4.5 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime) - * 4.2.1.4.6 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64) - * 4.2.1.4.7 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64.FromString.MissingTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64fromstringmissingtime) - * 4.2.1.4.8 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDecimal(32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodecimal3264128256) - * 4.2.1.4.9 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toString](#rqsrs-010datetime64extendedrangetypeconversionfunctionstostring) - * 4.2.1.4.10 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.CAST(x,T)](#rqsrs-010datetime64extendedrangetypeconversionfunctionscastxt) - * 4.2.1.4.11 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64milli) - * 4.2.1.4.12 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64micro) - * 4.2.1.4.13 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64nano) - * 4.2.1.4.14 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64milli) - * 4.2.1.4.15 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64micro) - * 4.2.1.4.16 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64nano) + * 4.2.1.5.1 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toInt(8|16|32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstoint8163264128256) + * 4.2.1.5.2 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUInt(8|16|32|64|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstouint8163264256) + * 4.2.1.5.3 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toFloat(32|64)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstofloat3264) + * 4.2.1.5.4 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodate) + * 4.2.1.5.5 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate32](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodate32) + * 4.2.1.5.6 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime) + * 4.2.1.5.7 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64) + * 4.2.1.5.8 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime64.FromString.MissingTime](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodatetime64fromstringmissingtime) + * 4.2.1.5.9 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDecimal(32|64|128|256)](#rqsrs-010datetime64extendedrangetypeconversionfunctionstodecimal3264128256) + * 4.2.1.5.10 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toString](#rqsrs-010datetime64extendedrangetypeconversionfunctionstostring) + * 4.2.1.5.11 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.CAST(x,T)](#rqsrs-010datetime64extendedrangetypeconversionfunctionscastxt) + * 4.2.1.5.12 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64milli) + * 4.2.1.5.13 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64micro) + * 4.2.1.5.14 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionstounixtimestamp64nano) + * 4.2.1.5.15 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Milli](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64milli) + * 4.2.1.5.16 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Micro](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64micro) + * 4.2.1.5.17 [RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.fromUnixTimestamp64Nano](#rqsrs-010datetime64extendedrangetypeconversionfunctionsfromunixtimestamp64nano) * 5 [References](#references) ## Revision History @@ -2555,9 +2643,20 @@ [9961200,73476000,325666800,354675600,370400400,386125200,388566010,401850000,417574811,496803600,528253200,624423614,636516015,671011200,717555600,752047218,859683600,922582800,1018173600,1035705600,1143334800,1162105223,1174784400,1194156000,1206838823,1224982823,1236495624,1319936400,1319936424,1425798025,1459040400,1509872400,2090451627,2140668000] ``` +##### RQ.SRS-010.DateTime64.ExtendedRange.Transform +version: 1.0 + +[ClickHouse] SHALL support `DateTime64` in [`transform`](https://clickhouse.com/docs/ru/sql-reference/functions/other-functions/#transform). ### Specific +##### RQ.SRS-010.DateTime64.ExtendedRange.ArrowFormat +version: 1.0 + +[ClickHouse] SHALL support exporting of [DateTime64] data type to +[Arrow](https://clickhouse.com/docs/en/interfaces/formats/#data-format-arrow) format and importing +[DateTime64] from corresponding Arrow data types. + ##### RQ.SRS-010.DateTime64.ExtendedRange.Start version: 1.0 @@ -3050,6 +3149,11 @@ to the [Date](https://clickhouse.com/docs/en/sql-reference/data-types/date/) type using the [toDate](https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions/#todate) function. This function is ONLY supposed to work in NORMAL RANGE. +###### RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDate32 +version: 1.0 + +[ClickHouse] SHALL support correct conversion of the [DateTime64] data type to the [Date32](https://clickhouse.com/docs/en/sql-reference/data-types/date32/) type using the [toDate32](https://clickhouse.com/docs/en/sql-reference/functions/type-conversion-functions/#todate32) function. + ###### RQ.SRS-010.DateTime64.ExtendedRange.TypeConversionFunctions.toDateTime version: 1.0 @@ -3133,8 +3237,8 @@ * **DateTime64**: https://clickhouse.com/docs/en/sql-reference/data-types/datetime64/ * **ISO 8601 format**: https://en.wikipedia.org/wiki/ISO_8601 * **ClickHouse:** https://clickhouse.com -* **GitHub Repository:** https://github.com/ClickHouse/ClickHouse/blob/master/tests/testflows/datetime64_extended_range/requirements/requirements.md -* **Revision History:** https://github.com/ClickHouse/ClickHouse/commits/master/tests/testflows/datetime64_extended_range/requirements/requirements.md +* **GitLab Repository:** https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/blob/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md +* **Revision History:** https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/commits/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md * **Git:** https://git-scm.com/ [SRS]: #srs @@ -3144,9 +3248,9 @@ [DateTime64]: https://clickhouse.com/docs/en/sql-reference/data-types/datetime64/ [ISO 8601 format]: https://en.wikipedia.org/wiki/ISO_8601 [ClickHouse]: https://clickhouse.com -[GitHub Repository]: https://github.com/ClickHouse/ClickHouse/blob/master/tests/testflows/datetime64_extended_range/requirements/requirements.md -[Revision History]: https://github.com/ClickHouse/ClickHouse/commits/master/tests/testflows/datetime64_extended_range/requirements/requirements.md +[GitLab Repository]: https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/blob/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md +[Revision History]: https://gitlab.com/altinity-qa/documents/qa-srs010-clickhouse-datetime64-extended-range/-/commits/master/QA_SRS010_ClickHouse_DateTime64_Extended_Range.md [Git]: https://git-scm.com/ -[GitHub]: https://github.com +[GitLab]: https://gitlab.com """, ) diff --git a/tests/testflows/datetime64_extended_range/tests/common.py b/tests/testflows/datetime64_extended_range/tests/common.py index 1154cf21b92..93106fbc618 100644 --- a/tests/testflows/datetime64_extended_range/tests/common.py +++ b/tests/testflows/datetime64_extended_range/tests/common.py @@ -16,7 +16,7 @@ def in_normal_range(dt: datetime.datetime): def years_range(stress=False, padding=(0, 0)): """Returns a set of year values used for testing.""" - return range(1925 + padding[0], 2283 - padding[1]) if stress else (1927, 2000, 2281) + return range(1925 + padding[0], 2238 - padding[1]) if stress else (1927, 2000, 2236) def timezones_range(stress=False): @@ -124,7 +124,7 @@ def exec_query(self, request, expected=None, exitcode=None): assert r.exitcode == exitcode, error() -@TestStep +@TestOutline def walk_datetime_in_incrementing_steps( self, date, hrs_range=(0, 24), step=1, timezone="UTC", precision=0 ): @@ -137,39 +137,27 @@ def walk_datetime_in_incrementing_steps( """ stress = self.context.stress + secs = f"00{'.' * (precision > 0)}{'0' * precision}" - with Pool(2) as pool: - try: - with When( - f"I loop through datetime range {hrs_range} starting from {date} in {step}min increments" - ): - for hrs in ( - range(*hrs_range) if stress else (hrs_range[0], hrs_range[1] - 1) - ): - for mins in range(0, 60, step) if stress else (0, 59): - datetime = ( - f"{date} {str(hrs).zfill(2)}:{str(mins).zfill(2)}:{secs}" - ) - expected = datetime - - with When(f"time is {datetime}"): - Test( - name=f"{hrs}:{mins}:{secs}", - test=select_check_datetime, - parallel=True, - executor=pool, - )( - datetime=datetime, - precision=precision, - timezone=timezone, - expected=expected, - ) - finally: - join() - - -@TestStep + with When( + f"I loop through datetime range {hrs_range} starting from {date} in {step} min increments" + ): + for hrs in range(*hrs_range) if stress else (hrs_range[0], hrs_range[1] - 1): + for mins in range(0, 60, step) if stress else (0, 59): + datetime = f"{date} {str(hrs).zfill(2)}:{str(mins).zfill(2)}:{secs}" + expected = datetime + + with When(f"time is {datetime}"): + select_check_datetime( + datetime=datetime, + precision=precision, + timezone=timezone, + expected=expected, + ) + + +@TestOutline def walk_datetime_in_decrementing_steps( self, date, hrs_range=(23, 0), step=1, timezone="UTC", precision=0 ): @@ -182,34 +170,23 @@ def walk_datetime_in_decrementing_steps( :param step: step in minutes :param timezone: String """ + stress = self.context.stress + secs = f"00{'.' * (precision > 0)}{'0' * precision}" - with Pool(2) as pool: - try: - with When( - f"I loop through datetime range {hrs_range} starting from {date} in {step}min decrements" - ): - for hrs in ( - range(*hrs_range, -1) if stress else (hrs_range[1], hrs_range[0]) - ): - for mins in range(59, 0, -step) if stress else (59, 0): - datetime = ( - f"{date} {str(hrs).zfill(2)}:{str(mins).zfill(2)}:{secs}" - ) - expected = datetime - - with When(f"time is {datetime}"): - Test( - name=f"{hrs}:{mins}:{secs}", - test=select_check_datetime, - parallel=True, - executor=pool, - )( - datetime=datetime, - precision=precision, - timezone=timezone, - expected=expected, - ) - finally: - join() + with When( + f"I loop through datetime range {hrs_range} starting from {date} in {step}min decrements" + ): + for hrs in range(*hrs_range, -1) if stress else (hrs_range[1], hrs_range[0]): + for mins in range(59, 0, -step) if stress else (59, 0): + datetime = f"{date} {str(hrs).zfill(2)}:{str(mins).zfill(2)}:{secs}" + expected = datetime + + with When(f"time is {datetime}"): + select_check_datetime( + datetime=datetime, + precision=precision, + timezone=timezone, + expected=expected, + ) diff --git a/tests/testflows/datetime64_extended_range/tests/date_time_functions.py b/tests/testflows/datetime64_extended_range/tests/date_time_functions.py index 53add63e8f2..9d743e99885 100644 --- a/tests/testflows/datetime64_extended_range/tests/date_time_functions.py +++ b/tests/testflows/datetime64_extended_range/tests/date_time_functions.py @@ -2,8 +2,9 @@ import pytz import itertools from testflows.core import * +from dateutil.tz import tzlocal import dateutil.relativedelta as rd -from datetime import datetime +from datetime import datetime, timedelta from datetime64_extended_range.requirements.requirements import * from datetime64_extended_range.common import * @@ -20,7 +21,7 @@ def to_time_zone(self): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for dt in datetimes: @@ -47,7 +48,7 @@ def to_date_part(self, py_func, ch_func): datetimes = select_dates_in_year(year=year, stress=stress) timezones = timezones_range(stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): with Step(f"{dt} {tz1}, {tz2}"): @@ -113,7 +114,7 @@ def to_day_of(self, py_func, ch_func): datetimes = select_dates_in_year(year=year, stress=stress) timezones = timezones_range(stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): with When(f"{dt} {tz1} -> {tz2}"): @@ -168,7 +169,7 @@ def to_time_part(self, py_func, ch_func): datetimes = select_dates_in_year(year=year, stress=stress) timezones = timezones_range(stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): with Step(f"{dt} {tz1} -> {tz2}"): @@ -222,7 +223,7 @@ def to_unix_timestamp(self): datetimes = select_dates_in_year(year=year, stress=stress) timezones = timezones_range(stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -248,7 +249,7 @@ def to_start_of_year(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): with Step(f"{dt} {tz1} -> {tz2}"): @@ -284,7 +285,7 @@ def to_start_of_iso_year(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -314,8 +315,7 @@ def to_start_of_quarter(self): for year in years_range(stress): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): with Step(f"{dt} {tz1} -> {tz2}"): @@ -346,8 +346,7 @@ def to_start_of_month(self): for year in years_range(stress=stress): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): with Step(f"{dt} {tz1} -> {tz2}"): @@ -376,8 +375,7 @@ def to_monday(self): for year in years_range(stress): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): with Step(f"{dt} {tz1} -> {tz2}"): @@ -411,8 +409,7 @@ def to_start_of_week(self): for year in years_range(stress): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz1, tz2 in itertools.product(timezones, timezones): for mode in ( @@ -450,8 +447,7 @@ def to_start_of_day(self): for year in years_range(stress): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -477,7 +473,7 @@ def to_start_of_hour(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -503,7 +499,7 @@ def to_start_of_minute(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -531,7 +527,7 @@ def to_start_of_second(self): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -556,7 +552,7 @@ def to_start_of_minutes_interval(self, interval, func): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -689,7 +685,7 @@ def to_start_of_interval(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: for interval in intervals_testing_ranges.keys(): @@ -720,7 +716,7 @@ def to_iso(self, func, isocalendar_pos): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -766,7 +762,7 @@ def to_time(self): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with When(f"{dt} {tz}"): @@ -798,7 +794,7 @@ def to_relative_quarter_num(self): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with When(f"{dt} {tz}"): @@ -825,8 +821,7 @@ def to_relative_week_num(self): datetimes = select_dates_in_year( year=year, stress=stress, microseconds=True ) - - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with When(f"{dt} {tz}"): @@ -862,7 +857,7 @@ def to_relative_month_num(self): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with When(f"{dt} {tz}"): @@ -891,7 +886,7 @@ def to_relative_day_num(self): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with When(f"{dt} {tz}"): @@ -919,7 +914,7 @@ def to_relative_time(self, divisor, func): year=year, stress=stress, microseconds=True ) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with When(f"{dt} {tz}"): @@ -1113,7 +1108,7 @@ def to_week_year_week(self, clh_func, ret_year): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: for mode in range(0, 10): @@ -1160,7 +1155,7 @@ def to_yyyymm(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -1190,7 +1185,7 @@ def to_yyyymmdd(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -1222,7 +1217,7 @@ def to_yyyymmddhhmmss(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: with Step(f"{dt} {tz}"): @@ -1246,11 +1241,11 @@ def now(self): timezones = timezones_range(stress) for tz in timezones: - with Given(f"I record current time and localize it for {tz}"): - dt = datetime.datetime.now() + with Given("I record current time and localize it"): + dt = datetime.datetime.now(tzlocal()) dt = dt.astimezone(pytz.timezone(tz)) - with Step(f"{dt} in {tz}"): + with Step(f"{dt} {tz}"): with When("I execute query and format its result to string"): r = self.context.node.query(f"SELECT toDateTime64(now(), 0, '{tz}')") query_result = r.output @@ -1279,8 +1274,8 @@ def today(self): timezones = timezones_range(stress) for tz in timezones: - with Given(f"I record current time and localize it for {tz}"): - dt = datetime.datetime.now() + with Given("I record current time and localize it"): + dt = datetime.datetime.now(tzlocal()) dt = dt.astimezone(pytz.timezone(tz)) with Step(f"{dt} {tz}"): @@ -1300,8 +1295,8 @@ def today(self): else: diff = (dt - received_dt).total_seconds() - with Finally(f"I expect {diff} < 24 hours"): - assert diff < 86400, error() + with Finally(f"I expect {diff} < 48 hours (due to timezone mismatch)"): + assert diff < 172800, error() @TestScenario @@ -1315,8 +1310,8 @@ def yesterday(self): timezones = timezones_range(stress) for tz in timezones: - with Given(f"I record current time and localize it for {tz}"): - dt = datetime.datetime.now() + with Given("I record current time and localize it"): + dt = datetime.datetime.now(tzlocal()) dt = dt.astimezone(pytz.timezone(tz)) with Step(f"{dt} {tz}"): @@ -1364,7 +1359,7 @@ def add_subtract_functions( with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for tz in timezones: for incr in test_range: @@ -1686,7 +1681,7 @@ def format_date_time(self): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - with When(f"I format the datetimes in {year} in every possible way"): + with And("I format the datetimes in every possible way"): for dt in datetimes: for tz in timezones: for mode in modes: @@ -1741,8 +1736,7 @@ def time_slots(self): for year in years_range(stress=stress): with Given(f"I choose datetimes in {year}"): datetimes = select_dates_in_year(year=year, stress=stress) - - with When(f"I check each of the datetimes in {year}"): + with When("I check each of the datetimes"): for dt in datetimes: for duration in range(1, 100, 9): for size in range(1, 50, 3): @@ -1770,9 +1764,5 @@ def date_time_funcs(self, node="clickhouse1"): """Check the basic operations with DateTime64""" self.context.node = self.context.cluster.node(node) - with Pool(4) as pool: - try: - for scenario in loads(current_module(), Scenario): - Scenario(run=scenario, parallel=True, executor=pool) - finally: - join() + for scenario in loads(current_module(), Scenario): + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/datetime64_extended_range/tests/format_conversion.py b/tests/testflows/datetime64_extended_range/tests/format_conversion.py new file mode 100644 index 00000000000..6363b92b3a0 --- /dev/null +++ b/tests/testflows/datetime64_extended_range/tests/format_conversion.py @@ -0,0 +1,120 @@ +import os +import time +import pytz +import decimal +import pyarrow +from dateutil.tz import tzlocal +from datetime import datetime, timedelta +import dateutil.relativedelta as rd +from testflows.core import * + +from datetime64_extended_range.requirements.requirements import * +from datetime64_extended_range.common import * +from datetime64_extended_range.tests.common import * + + +@TestScenario +@Requirements(RQ_SRS_010_DateTime64_ExtendedRange_ArrowFormat("1.0")) +def arrow_format(self): + """Check that DateTime64 is properly represented in Arrow format.""" + node = self.context.node + stress = self.context.stress + timezones = timezones_range(stress=stress) + + try: + for year in years_range(stress): + with Given("I select datetimes in a year"): + datetimes = select_dates_in_year(year=year, stress=stress) + + for dt in datetimes: + for tz in timezones: + for precision in (0, 3, 6): + with Step(f"{dt} {tz}"): + with Given("I drop remaining tables"): + exec_query(request="DROP TABLE IF EXISTS t_src SYNC") + exec_query(request="DROP TABLE IF EXISTS t_dst SYNC") + + dt_str = f'{dt.strftime("%Y-%m-%d %H:%M:%S")}.123456789'[ + : (precision - 9) + ] + if precision == 0: + dt_str = dt.strftime("%Y-%m-%d %H:%M:%S") + + with Check("reading and writing one-line arrow file"): + with When("I create .arrow file"): + query = f"SELECT toDateTime64('{dt_str}', {precision}, '{tz}') FORMAT Arrow" + node.cmd( + cmd=f'clickhouse client --query="{query}" > /var/lib/ch-files/a.arrow' + ) + + with When("I check recorded values"): + data_dict = ( + pyarrow.ipc.open_file( + os.path.join( + os.path.dirname( + os.path.dirname(__file__) + ), + "_instances/clickhouse1/files/a.arrow", + ) + ) + .read_all() + .to_pydict() + ) + + assert dt_str in list(data_dict.values())[0][ + 0 + ].strftime("%Y-%m-%d %H:%M:%S.%f"), error() + + with Check("DT64 -> DT conversion on insert works"): + with Given( + "I create tables to generate and paste values" + ): + exec_query( + request=f"CREATE TABLE t_src " + f"(id Int8, d DateTime64({precision}, '{tz}')) " + f"ENGINE=MergeTree() ORDER BY id" + ) + exec_query( + request=f"CREATE TABLE t_dst " + f"(id Int8, d DateTime('{tz}')) " + f"ENGINE=MergeTree() ORDER BY id" + ) + + with When( + "I insert value into source table and dump it" + ): + exec_query( + request=f"INSERT INTO t_src VALUES (1, toDateTime64('{dt_str}', {precision}, '{tz}'))" + ) + node.cmd( + cmd=f'clickhouse client --query="SELECT * FROM t_src FORMAT Arrow" > /var/lib/ch-files/a.arrow' + ) + + with Then( + "I read file into table with implicit DT conversion" + ): + node.cmd( + cmd=f"cat /var/lib/ch-files/a.arrow | " + f'clickhouse client --query="INSERT INTO t_dst FORMAT Arrow"', + exitcode=0, + ) + + if in_normal_range(dt): + with And("I check pasted DateTime is correct"): + assert ( + dt.strftime("%Y-%m-%d %H:%M:%S") + in node.query(f"SELECT * FROM t_dst").output + ), error() + + finally: + exec_query(request="DROP TABLE IF EXISTS t SYNC") + node.cmd("rm /var/lib/ch-files/a.arrow") + + +@TestFeature +def format_conversion(self, node="clickhouse1"): + """Check that DateTime64 is properly represented in different formats.""" + self.context.node = self.context.cluster.node(node) + + for scenario in loads(current_module(), Scenario): + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/datetime64_extended_range/tests/generic.py b/tests/testflows/datetime64_extended_range/tests/generic.py index 9ac2975e5a2..b63f6d9c0b0 100644 --- a/tests/testflows/datetime64_extended_range/tests/generic.py +++ b/tests/testflows/datetime64_extended_range/tests/generic.py @@ -5,6 +5,7 @@ from datetime64_extended_range.tests.common import * import pytz +import datetime import itertools @@ -62,7 +63,7 @@ def extended_range_end(self, precision=3): ) -@TestScenario +@TestOutline(Scenario) @Requirements( RQ_SRS_010_DateTime64_ExtendedRange_NormalRange_Start_BeforeEpochForTimeZone("1.0") ) @@ -79,7 +80,7 @@ def timezone_local_below_normal_range(self): ) -@TestScenario +@TestOutline(Scenario) @Requirements( RQ_SRS_010_DateTime64_ExtendedRange_NormalRange_End_AfterEpochForTimeZone("1.0") ) @@ -146,10 +147,20 @@ def timezones_support(self): exec_query(request=query, expected=f"{dt_str}") +@TestScenario +@Requirements(RQ_SRS_010_DateTime64_ExtendedRange_Transform("1.0")) +def transform(self): + """Simple check that transform can accept DateTime64 as argument.""" + with When("forming a toTimeZone ClickHouse query"): + query = "SELECT transform('a', ['a', 'b'], [toDateTime64(0, 3, 'UTC'), toDateTime(1, 3, 'UTC')], toDateTime64(0,3))" + with Then(f"I execute query", flags=TE): + exec_query(request=query, expected="1970-01-01 00:00:00.000") + + @TestFeature def generic(self, node="clickhouse1"): """Check the basic operations with DateTime64""" self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario, Suite): - Scenario(run=scenario) + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/datetime64_extended_range/tests/non_existent_time.py b/tests/testflows/datetime64_extended_range/tests/non_existent_time.py index 0e3e180fe23..8f8cf678afe 100644 --- a/tests/testflows/datetime64_extended_range/tests/non_existent_time.py +++ b/tests/testflows/datetime64_extended_range/tests/non_existent_time.py @@ -198,4 +198,4 @@ def feature(self, node="clickhouse1"): self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario, Suite): - Scenario(run=scenario) + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/datetime64_extended_range/tests/reference_times.py b/tests/testflows/datetime64_extended_range/tests/reference_times.py index 9cd9fadc35c..aa456d95079 100644 --- a/tests/testflows/datetime64_extended_range/tests/reference_times.py +++ b/tests/testflows/datetime64_extended_range/tests/reference_times.py @@ -3,6 +3,7 @@ from testflows.core import * from datetime64_extended_range.common import * +from datetime64_extended_range.tests.common import select_check_datetime from datetime64_extended_range.requirements.requirements import * from datetime64_extended_range.tests.common import * diff --git a/tests/testflows/datetime64_extended_range/tests/type_conversion.py b/tests/testflows/datetime64_extended_range/tests/type_conversion.py index c52ecdce582..a1b32cb10bf 100644 --- a/tests/testflows/datetime64_extended_range/tests/type_conversion.py +++ b/tests/testflows/datetime64_extended_range/tests/type_conversion.py @@ -41,7 +41,7 @@ def to_int_8_16_32_64_128_256(self, cast): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for d in datetimes: @@ -100,7 +100,7 @@ def to_uint_8_16_32_64_256(self, cast): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for d in datetimes: @@ -159,7 +159,7 @@ def to_float_32_64(self, cast): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for d in datetimes: @@ -195,7 +195,7 @@ def to_datetime64_from_string_missing_time(self): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for dt in datetimes: @@ -221,7 +221,7 @@ def to_datetime64(self): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for dt in datetimes: @@ -264,7 +264,7 @@ def to_date(self, cast): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for dt in datetimes: @@ -290,6 +290,60 @@ def to_date(self, cast): exec_query(request=query, expected=expected, exitcode=0) +@TestOutline(Scenario) +@Examples( + "cast", + [ + ( + False, + Requirements( + RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_toDate32( + "1.0" + ) + ), + ), + ( + True, + Requirements( + RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_CAST_x_T_( + "1.0" + ) + ), + ), + ], +) +def to_date32(self, cast): + """Check the toDate32() conversion with DateTime64.""" + stress = self.context.stress + timezones = timezones_range(stress) + + for year in years_range(stress): + with Given("I select datetimes in a year"): + datetimes = select_dates_in_year(year=year, stress=stress) + + for dt in datetimes: + for tz in timezones: + with Step(f"{dt} {tz}"): + expected = None # by default - not checked, checking the exitcode + with By("converting datetime to string"): + dt_str = dt.strftime("%Y-%m-%d %H:%M:%S") + + if in_normal_range(dt): + with And("DateTime64 fits normal range, change its value"): + expected = f"{dt.strftime('%Y-%m-%d')}" + + with Given(f"I make a query string for ClickHouse"): + if cast: + query = f"SELECT CAST(toDateTime64('{dt_str}', 0, '{tz}'), 'Date32')" + else: + query = ( + f"SELECT toDate32(toDateTime64('{dt_str}', 0, '{tz}'))" + ) + + with Then(f"I execute toDate32() query and check return/exitcode"): + exec_query(request=query, expected=expected, exitcode=0) + + @TestOutline(Scenario) @Examples( "cast", @@ -318,7 +372,7 @@ def to_datetime(self, cast): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for dt in datetimes: @@ -327,15 +381,13 @@ def to_datetime(self, cast): dt_str = dt.strftime("%Y-%m-%d %H:%M:%S") with And(f"making a query string for ClickHouse"): if cast: - query = f"SELECT CAST(toDateTime64('{dt_str}', 0, '{tz}'), 'DateTime')" + query = f"SELECT CAST(toDateTime('{dt_str}', 0, '{tz}'), 'DateTime')" with When("figure out expected result in python"): dt_local = pytz.timezone(tz).localize(dt) dt_transformed = dt_local.astimezone(tzlocal()) expected = f"{dt_transformed.strftime('%Y-%m-%d %H:%M:%S')}" else: - query = ( - f"SELECT toDateTime(toDateTime64('{dt_str}', 0, '{tz}'))" - ) + query = f"SELECT toDateTime(toDateTime('{dt_str}', 0, '{tz}'))" with When("figure out expected result in python"): expected = f"{dt.strftime('%Y-%m-%d %H:%M:%S')}" @@ -375,7 +427,7 @@ def to_string(self, cast): timezones = timezones_range(stress) for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for dt in datetimes: @@ -438,7 +490,7 @@ def to_decimal_32_64_128_256(self, cast): scales = {32: 9, 64: 18, 128: 38, 256: 76} for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year(year=year, stress=stress) for d in datetimes: @@ -474,7 +526,7 @@ def to_unix_timestamp64_milli_micro_nano(self, scale): func = {3: "Milli", 6: "Micro", 9: "Nano"} for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year( year=year, stress=stress, microseconds=True ) @@ -542,7 +594,7 @@ def from_unix_timestamp64_milli_micro_nano(self, scale): func = {3: "Milli", 6: "Micro", 9: "Nano"} for year in years_range(stress): - with Given(f"I select datetimes in {year}"): + with Given("I select datetimes in a year"): datetimes = select_dates_in_year( year=year, stress=stress, microseconds=True ) @@ -568,6 +620,82 @@ def from_unix_timestamp64_milli_micro_nano(self, scale): exec_query(request=query, expected=f"{d_str}") +@TestScenario +def force_index_by_date(self): + """Check that when force_index_by_date is enabled, ClickHouse throws an exception if there is a partition key in a table, and it is not used.""" + node = self.context.node + table_name = f"table_{getuid()}" + + try: + with Given("I have a table"): + node.query( + f""" + create table {table_name}(date_time DateTime64(3), x String) + Engine=MergeTree partition by toDate(date_time) order by tuple(); + """ + ) + + with And("I insert some data"): + node.query( + f"insert into {table_name} select toDateTime64('2020-01-01 00:00:00.000',3)+number , '' from numbers(1);" + ) + + with When("I select from the table"): + output = node.query( + f"SELECT count() FROM {table_name} WHERE date_time >= toDateTime64('2020-01-01 00:00:00.000',3) SETTINGS force_index_by_date=1;" + ).output + assert output == "1", error() + + with Then("I check SELECT throws an exception."): + node.query( + f"SELECT count() FROM {table_name} WHERE toDateTime64(date_time,3) >= toDateTime64('2020-01-10 00:00:00.000',3) SETTINGS force_index_by_date=1;", + exitcode=21, + message="DB::Exception: Neither MinMax index by columns (date_time) nor partition expr is used and setting 'force_index_by_date' is set. (INDEX_NOT_USED)", + ) + + finally: + with Finally(f"I drop the table {table_name}"): + node.query(f"DROP TABLE IF EXISTS {table_name}") + + +@TestScenario +def force_primary_key(self): + """Check that when force_primary_key is enabled, ClickHOuse throws an exception if there is primary key in a table, and it is not used.""" + node = self.context.node + table_name = f"table_{getuid()}" + + try: + with Given("I have a table"): + node.query( + f""" + create table {table_name}(date_time DateTime64(3), x String) + Engine=MergeTree partition by toDate(date_time) primary key toDate(date_time); + """ + ) + + with And("I insert some data"): + node.query( + f"insert into {table_name} select toDateTime64('2020-01-01 00:00:00.000',3)+number , '' from numbers(1);" + ) + + with When("I select from the table"): + output = node.query( + f"SELECT count() FROM {table_name} WHERE date_time >= toDateTime64('2020-01-01 00:00:00.000',3) SETTINGS force_primary_key=1;" + ).output + assert output == "1", error() + + with Then("I check SELECT throws an exception."): + node.query( + f"SELECT count() FROM {table_name} WHERE toDateTime64(date_time,3) >= toDateTime64('2020-01-10 00:00:00.000',3) SETTINGS force_primary_key=1;", + exitcode=21, + message="Exception: Primary key (toDate(date_time)) is not used and setting 'force_primary_key' is set. (INDEX_NOT_USED)", + ) + + finally: + with Finally(f"I drop the table {table_name}"): + node.query(f"DROP TABLE IF EXISTS {table_name}") + + @TestScenario @Requirements( RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions_fromUnixTimestamp64Milli( @@ -604,11 +732,10 @@ def from_unix_timestamp64_nano(self): @TestFeature @Requirements(RQ_SRS_010_DateTime64_ExtendedRange_TypeConversionFunctions("1.0")) def type_conversion(self, node="clickhouse1"): - """Check the type conversion operations with DateTime64. - Cast can be set as Requirement thereby as the module + """Check the type conversion operations with DateTime64. Cast can be set as Requirement thereby as the module tests exactly what CAST does. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): - Scenario(run=scenario) + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/example/configs/clickhouse/common.xml b/tests/testflows/example/configs/clickhouse/common.xml new file mode 100644 index 00000000000..31fa972199f --- /dev/null +++ b/tests/testflows/example/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + 0.0.0.0 + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/example/configs/clickhouse/config.xml b/tests/testflows/example/configs/clickhouse/config.xml new file mode 100644 index 00000000000..9854f9f990e --- /dev/null +++ b/tests/testflows/example/configs/clickhouse/config.xml @@ -0,0 +1,436 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + /var/lib/clickhouse/access/ + + + users.xml + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 7200 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/example/configs/clickhouse/users.xml b/tests/testflows/example/configs/clickhouse/users.xml new file mode 100644 index 00000000000..c7d0ecae693 --- /dev/null +++ b/tests/testflows/example/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/example/example_env/clickhouse-service.yml b/tests/testflows/example/example_env/clickhouse-service.yml index 0c9352dbc0b..7a3be6281f7 100644 --- a/tests/testflows/example/example_env/clickhouse-service.yml +++ b/tests/testflows/example/example_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 expose: - "9000" - "9009" diff --git a/tests/testflows/example/example_env/docker-compose.yml b/tests/testflows/example/example_env/docker-compose.yml index 4edb415824f..0d2aa7a1ac7 100644 --- a/tests/testflows/example/example_env/docker-compose.yml +++ b/tests/testflows/example/example_env/docker-compose.yml @@ -23,7 +23,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/example/example_env/zookeeper-service.yml b/tests/testflows/example/example_env/zookeeper-service.yml index ca732a48dbd..33cc799ab4c 100644 --- a/tests/testflows/example/example_env/zookeeper-service.yml +++ b/tests/testflows/example/example_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.6.2 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/example/example_env_arm64/clickhouse-service.yml b/tests/testflows/example/example_env_arm64/clickhouse-service.yml index a73d31421c8..cd7284359aa 100644 --- a/tests/testflows/example/example_env_arm64/clickhouse-service.yml +++ b/tests/testflows/example/example_env_arm64/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:21.12 + image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:8.9.2022 privileged: true expose: - "9000" diff --git a/tests/testflows/example/example_env_arm64/docker-compose.yml b/tests/testflows/example/example_env_arm64/docker-compose.yml index 4edb415824f..0d2aa7a1ac7 100644 --- a/tests/testflows/example/example_env_arm64/docker-compose.yml +++ b/tests/testflows/example/example_env_arm64/docker-compose.yml @@ -23,7 +23,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/example/example_env_arm64/zookeeper-service.yml b/tests/testflows/example/example_env_arm64/zookeeper-service.yml index ca732a48dbd..9934af01b82 100644 --- a/tests/testflows/example/example_env_arm64/zookeeper-service.yml +++ b/tests/testflows/example/example_env_arm64/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.6.2 + image: ${IMAGE_DEPENDENCY_PROXY}arm64v8/zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/extended_precision_data_types/common.py b/tests/testflows/extended_precision_data_types/common.py index 959ff96a536..db85aba44f8 100644 --- a/tests/testflows/extended_precision_data_types/common.py +++ b/tests/testflows/extended_precision_data_types/common.py @@ -80,9 +80,17 @@ def execute_query( else: with Then("I check output against snapshot"): with values() as that: + snapshot_name = ( + "tests.pre22.3" + if check_clickhouse_version("<22.3")(current()) + else "tests.post22.3" + ) assert that( snapshot( - "\n" + r.output.strip() + "\n", "tests", name=name, encoder=str + "\n" + r.output.strip() + "\n", + snapshot_name, + name=name, + encoder=str, ) ), error() diff --git a/tests/testflows/extended_precision_data_types/configs/clickhouse/common.xml b/tests/testflows/extended_precision_data_types/configs/clickhouse/common.xml new file mode 100644 index 00000000000..0ba01589b90 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + :: + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/extended_precision_data_types/configs/clickhouse/config.xml b/tests/testflows/extended_precision_data_types/configs/clickhouse/config.xml new file mode 100644 index 00000000000..842a0573d49 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/configs/clickhouse/config.xml @@ -0,0 +1,448 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + 0.0.0.0 + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + /var/lib/clickhouse/access/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + users.xml + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/extended_precision_data_types/configs/clickhouse/users.xml b/tests/testflows/extended_precision_data_types/configs/clickhouse/users.xml new file mode 100644 index 00000000000..c7d0ecae693 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/extended_precision_data_types/extended-precision-data-type_env/clickhouse-service.yml b/tests/testflows/extended_precision_data_types/extended-precision-data-type_env/clickhouse-service.yml index afb31f77c94..9162d06bf27 100644 --- a/tests/testflows/extended_precision_data_types/extended-precision-data-type_env/clickhouse-service.yml +++ b/tests/testflows/extended_precision_data_types/extended-precision-data-type_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: altinityinfra/integration-test expose: - "9000" - "9009" diff --git a/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/clickhouse-service.yml b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/clickhouse-service.yml new file mode 100644 index 00000000000..41647b89aeb --- /dev/null +++ b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/clickhouse-service.yml @@ -0,0 +1,28 @@ +version: '2.3' + +services: + clickhouse: + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 + init: true + expose: + - "9000" + - "9009" + - "8123" + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" + - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" + entrypoint: bash -c "tail -f /dev/null" + healthcheck: + test: echo 1 + interval: 10s + timeout: 10s + retries: 3 + start_period: 300s + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/docker-compose.yml b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/docker-compose.yml new file mode 100644 index 00000000000..d0071768317 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/docker-compose.yml @@ -0,0 +1,30 @@ +version: '2.3' + +services: + + mysql1: + extends: + file: mysql-service.yml + service: mysql + hostname: mysql1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/mysql1/database:/var/lib/mysql" + + clickhouse1: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" + + # dummy service which does nothing, but allows to postpone + # 'docker-compose up -d' till all dependecies will go healthy + all_services_ready: + image: ${IMAGE_DEPENDENCY_PROXY}hello-world + depends_on: + clickhouse1: + condition: service_healthy + mysql1: + condition: service_healthy diff --git a/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/mysql-service.yml b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/mysql-service.yml new file mode 100644 index 00000000000..5423b0e0dab --- /dev/null +++ b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env/mysql-service.yml @@ -0,0 +1,19 @@ +version: '2.3' + +services: + mysql: + image: ${IMAGE_DEPENDENCY_PROXY}mysql:5.7.30 + restart: always + environment: + MYSQL_DATABASE: 'db' + MYSQL_USER: 'user' + MYSQL_PASSWORD: 'password' + MYSQL_ROOT_PASSWORD: 'password' + expose: + - '3306' + healthcheck: + test: mysql -D db -u user --password=password -e "select 1;" + interval: 3s + timeout: 2s + retries: 40 + start_period: 2s diff --git a/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/clickhouse-service.yml b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/clickhouse-service.yml new file mode 100644 index 00000000000..1a5c52c83d1 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/clickhouse-service.yml @@ -0,0 +1,28 @@ +version: '2.3' + +services: + clickhouse: + image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:21.12 + privileged: true + expose: + - "9000" + - "9009" + - "8123" + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" + - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" + entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + healthcheck: + test: clickhouse client --query='select 1' + interval: 10s + timeout: 10s + retries: 3 + start_period: 300s + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/docker-compose.yml b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/docker-compose.yml new file mode 100644 index 00000000000..d0071768317 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/docker-compose.yml @@ -0,0 +1,30 @@ +version: '2.3' + +services: + + mysql1: + extends: + file: mysql-service.yml + service: mysql + hostname: mysql1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/mysql1/database:/var/lib/mysql" + + clickhouse1: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" + + # dummy service which does nothing, but allows to postpone + # 'docker-compose up -d' till all dependecies will go healthy + all_services_ready: + image: ${IMAGE_DEPENDENCY_PROXY}hello-world + depends_on: + clickhouse1: + condition: service_healthy + mysql1: + condition: service_healthy diff --git a/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/mysql-service.yml b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/mysql-service.yml new file mode 100644 index 00000000000..fe957e7be0f --- /dev/null +++ b/tests/testflows/extended_precision_data_types/extended_precision_data_types_env_arm64/mysql-service.yml @@ -0,0 +1,19 @@ +version: '2.3' + +services: + mysql: + image: ${IMAGE_DEPENDENCY_PROXY}mariadb:10.3 + restart: always + environment: + MYSQL_DATABASE: 'db' + MYSQL_USER: 'user' + MYSQL_PASSWORD: 'password' + MYSQL_ROOT_PASSWORD: 'password' + expose: + - '3306' + healthcheck: + test: mysql -D db -u user --password=password -e "select 1;" + interval: 3s + timeout: 2s + retries: 40 + start_period: 2s diff --git a/tests/testflows/extended_precision_data_types/regression.py b/tests/testflows/extended_precision_data_types/regression.py index f185a5e4ecb..7e289ab20c9 100755 --- a/tests/testflows/extended_precision_data_types/regression.py +++ b/tests/testflows/extended_precision_data_types/regression.py @@ -24,25 +24,29 @@ @Requirements( RQ_SRS_020_ClickHouse_Extended_Precision("1.0"), ) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """Extended precision data type regression.""" nodes = {"clickhouse": ("clickhouse1",)} - if stress is not None: - self.context.stress = stress + self.context.clickhouse_version = clickhouse_version + from platform import processor as current_cpu + + folder_name = os.path.basename(current_dir()) + if current_cpu() == "aarch64": + env = f"{folder_name}_env_arm64" + else: + env = f"{folder_name}_env" + with Cluster( local, clickhouse_binary_path, nodes=nodes, - docker_compose_project_dir=os.path.join( - current_dir(), "extended-precision-data-type_env" - ), + docker_compose_project_dir=os.path.join(current_dir(), env), ) as cluster: self.context.cluster = cluster + self.context.stress = stress Feature(run=load("extended_precision_data_types.tests.feature", "feature")) diff --git a/tests/testflows/extended_precision_data_types/snapshots/common.py.tests.post22.3.snapshot b/tests/testflows/extended_precision_data_types/snapshots/common.py.tests.post22.3.snapshot new file mode 100644 index 00000000000..95542b61e19 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/snapshots/common.py.tests.post22.3.snapshot @@ -0,0 +1,6334 @@ +I_check_plus_with_Int128_max_and_min_value = r""" +round(plus(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(plus(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +-170141183460469231731687303715884105728 -170141183460469231731687303715884105727 +""" + +I_check_plus_with_Int256_max_and_min_value = r""" +round(plus(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(plus(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 -57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_plus_with_UInt128_max_and_min_value = r""" +round(plus(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(plus(toUInt128(\'0\'), toUInt128(1)), 7) +0 1 +""" + +I_check_plus_with_UInt256_max_and_min_value = r""" +round(plus(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(plus(toUInt256(\'0\'), toUInt256(1)), 7) +0 1 +""" + +I_check_minus_with_Int128_max_and_min_value = r""" +round(minus(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(minus(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105726 170141183460469231731687303715884105727 +""" + +I_check_minus_with_Int256_max_and_min_value = r""" +round(minus(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(minus(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819966 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_minus_with_UInt128_max_and_min_value = r""" +round(minus(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(minus(toUInt128(\'0\'), toUInt128(1)), 7) +-2 -1 +""" + +I_check_minus_with_UInt256_max_and_min_value = r""" +round(minus(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(minus(toUInt256(\'0\'), toUInt256(1)), 7) +-2 -1 +""" + +I_check_multiply_with_Int128_max_and_min_value = r""" +round(multiply(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(multiply(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_multiply_with_Int256_max_and_min_value = r""" +round(multiply(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(multiply(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_multiply_with_UInt128_max_and_min_value = r""" +round(multiply(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(multiply(toUInt128(\'0\'), toUInt128(1)), 7) +340282366920938463463374607431768211455 0 +""" + +I_check_multiply_with_UInt256_max_and_min_value = r""" +round(multiply(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(multiply(toUInt256(\'0\'), toUInt256(1)), 7) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_divide_with_Int128_max_and_min_value = r""" +round(divide(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(divide(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +1.7014118346046923e38 -1.7014118346046923e38 +""" + +I_check_divide_with_Int256_max_and_min_value = r""" +round(divide(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(divide(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +5.78960446186581e76 -5.78960446186581e76 +""" + +I_check_divide_with_UInt128_max_and_min_value = r""" +round(divide(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(divide(toUInt128(\'0\'), toUInt128(1)), 7) +3.402823669209385e38 0 +""" + +I_check_divide_with_UInt256_max_and_min_value = r""" +round(divide(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(divide(toUInt256(\'0\'), toUInt256(1)), 7) +1.157920892373162e77 0 +""" + +I_check_intDiv_with_Int128_max_and_min_value = r""" +round(intDiv(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(intDiv(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_intDiv_with_Int256_max_and_min_value = r""" +round(intDiv(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(intDiv(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_intDiv_with_UInt128_max_and_min_value = r""" +round(intDiv(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(intDiv(toUInt128(\'0\'), toUInt128(1)), 7) +340282366920938463463374607431768211455 0 +""" + +I_check_intDiv_with_UInt256_max_and_min_value = r""" +round(intDiv(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(intDiv(toUInt256(\'0\'), toUInt256(1)), 7) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_intDivOrZero_with_Int128_max_and_min_value = r""" +round(intDivOrZero(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(intDivOrZero(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_intDivOrZero_with_Int256_max_and_min_value = r""" +round(intDivOrZero(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(intDivOrZero(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_intDivOrZero_with_UInt128_max_and_min_value = r""" +round(intDivOrZero(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(intDivOrZero(toUInt128(\'0\'), toUInt128(1)), 7) +340282366920938463463374607431768211455 0 +""" + +I_check_intDivOrZero_with_UInt256_max_and_min_value = r""" +round(intDivOrZero(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(intDivOrZero(toUInt256(\'0\'), toUInt256(1)), 7) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_modulo_with_Int128_max_and_min_value = r""" +round(modulo(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(modulo(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +0 0 +""" + +I_check_modulo_with_Int256_max_and_min_value = r""" +round(modulo(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(modulo(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +0 0 +""" + +I_check_modulo_with_UInt128_max_and_min_value = r""" +round(modulo(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(modulo(toUInt128(\'0\'), toUInt128(1)), 7) +0 0 +""" + +I_check_modulo_with_UInt256_max_and_min_value = r""" +round(modulo(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(modulo(toUInt256(\'0\'), toUInt256(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_Int128_max_and_min_value = r""" +round(moduloOrZero(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(moduloOrZero(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_Int256_max_and_min_value = r""" +round(moduloOrZero(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(moduloOrZero(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_UInt128_max_and_min_value = r""" +round(moduloOrZero(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(moduloOrZero(toUInt128(\'0\'), toUInt128(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_UInt256_max_and_min_value = r""" +round(moduloOrZero(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(moduloOrZero(toUInt256(\'0\'), toUInt256(1)), 7) +0 0 +""" + +I_check_negate_with_Int128_max_and_min_value = r""" +negate(toInt128(\'170141183460469231731687303715884105727\')) negate(toInt128(\'-170141183460469231731687303715884105728\')) +-170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_negate_with_Int256_max_and_min_value = r""" +negate(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) negate(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_negate_with_UInt128_max_and_min_value = r""" +negate(toUInt128(\'340282366920938463463374607431768211455\')) negate(toUInt128(\'0\')) +1 0 +""" + +I_check_negate_with_UInt256_max_and_min_value = r""" +negate(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) negate(toUInt256(\'0\')) +1 0 +""" + +I_check_abs_with_Int128_max_and_min_value = r""" +abs(toInt128(\'170141183460469231731687303715884105727\')) abs(toInt128(\'-170141183460469231731687303715884105728\')) +170141183460469231731687303715884105727 170141183460469231731687303715884105728 +""" + +I_check_abs_with_Int256_max_and_min_value = r""" +abs(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) abs(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +57896044618658097711785492504343953926634992332820282019728792003956564819967 57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_abs_with_UInt128_max_and_min_value = r""" +abs(toUInt128(\'340282366920938463463374607431768211455\')) abs(toUInt128(\'0\')) +340282366920938463463374607431768211455 0 +""" + +I_check_abs_with_UInt256_max_and_min_value = r""" +abs(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) abs(toUInt256(\'0\')) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_the_table_output_of_plus_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +-170141183460469231731687303715884105727 +2 +""" + +I_check_the_table_output_of_plus_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +2 +""" + +I_check_the_table_output_of_plus_with_UInt128 = r""" +a +0 +1 +2 +""" + +I_check_the_table_output_of_plus_with_UInt256 = r""" +a +0 +1 +2 +""" + +I_check_the_table_output_of_minus_with_Int128 = r""" +a +0 +170141183460469231731687303715884105726 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_minus_with_Int256 = r""" +a +0 +57896044618658097711785492504343953926634992332820282019728792003956564819966 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_minus_with_UInt128 = r""" +a +0 +340282366920938463463374607431768211454 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_minus_with_UInt256 = r""" +a +0 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_multiply_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_multiply_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_multiply_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_multiply_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_divide_with_Int128 = r""" +a +-170141183460469231722463931679029329921 +1 +170141183460469231722463931679029329921 +""" + +I_check_the_table_output_of_divide_with_Int256 = r""" +a +-57896044618658097702369839901263932781391731748390190090761097376371310592000 +1 +57896044618658097702369839901263932781391731748390190090761097376371310592000 +""" + +I_check_the_table_output_of_divide_with_UInt128 = r""" +a +0 +1 +340282366920938463426481119284349108225 +""" + +I_check_the_table_output_of_divide_with_UInt256 = r""" +a +0 +1 +57896044618658097702369839901263932781391731748390190090761097376371310592000 +""" + +I_check_the_table_output_of_intDiv_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_intDiv_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_intDiv_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_intDiv_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_intDivOrZero_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_intDivOrZero_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_intDivOrZero_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_intDivOrZero_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_modulo_with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_modulo_with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_modulo_with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_modulo_with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_negate_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +-170141183460469231731687303715884105727 +-1 +""" + +I_check_the_table_output_of_negate_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +-1 +""" + +I_check_the_table_output_of_negate_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_negate_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_abs_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_abs_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_abs_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_abs_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_gcd_with_Int128 = r""" +a +1 +""" + +I_check_the_table_output_of_gcd_with_Int256 = r""" +a +1 +""" + +I_check_the_table_output_of_gcd_with_UInt128 = r""" +a +1 +1 +""" + +I_check_the_table_output_of_gcd_with_UInt256 = r""" +a +1 +1 +""" + +I_check_the_table_output_of_lcm_with_Int128 = r""" +a +1 +""" + +I_check_the_table_output_of_lcm_with_Int256 = r""" +a +1 +""" + +I_check_the_table_output_of_lcm_with_UInt128 = r""" +a +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_lcm_with_UInt256 = r""" +a +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_for_output_of_negate_with_Decimal256 = r""" +a +-1 +""" + +I_check_the_table_for_output_of_abs_with_Decimal256 = r""" +a +1 +""" + +Inline___Int128___arrayPopBack__ = r""" +arrayPopBack(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2] +""" + +Table___Int128___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___Int128___arrayPopFront__ = r""" +arrayPopFront(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[2,1] +""" + +Table___Int128___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___Int128___arraySort__ = r""" +arraySort(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayReverseSort__ = r""" +arrayReverseSort(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayDistinct__ = r""" +arrayDistinct(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayEnumerate__ = r""" +arrayEnumerate(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,1,1] +""" + +Table___Int128___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___Int128___arrayReverse__ = r""" +arrayReverse(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___Int128___reverse__ = r""" +reverse(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___reverse__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayFlatten__ = r""" +arrayFlatten(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayCompact__ = r""" +arrayCompact(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', [(1, 5)], array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[6] +""" + +Table___Int128___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___Int128___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[5,4,3] +""" + +Table___Int128___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___Int128___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,3,3] +""" + +Table___Int128___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___Int128___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,1,1] +""" + +Table___Int128___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___Int128___arrayConcat__toInt128__3____toInt128__2____toInt128__1_____ = r""" +arrayConcat(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___Int128___arrayConcat__toInt128__3____toInt128__2____toInt128__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___Int128___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1] +""" + +Table___Int128___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___Int128___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[[0,0,0]] +""" + +Table___Int128___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___Int128___arrayZip__toInt128__1_____ = r""" +arrayZip(array(toInt128(\'1\')), array(toInt128(\'3\'))) +[(1,3)] +""" + +Table___Int128___arrayZip__toInt128__1_____ = r""" +a +[(1,1)] +""" + +Inline___Int128___empty__ = r""" +empty(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +0 +""" + +Table___Int128___empty__ = r""" +a +0 +""" + +Inline___Int128___notEmpty__ = r""" +notEmpty(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___notEmpty__ = r""" +a +1 +""" + +Inline___Int128___length__ = r""" +length(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___length__ = r""" +a +3 +""" + +Inline___Int128___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___Int128___arrayUniq__ = r""" +arrayUniq(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayUniq__ = r""" +a +3 +""" + +Inline___Int128___arrayJoin__ = r""" +arrayJoin(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +2 +1 +""" + +Table___Int128___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___Int128___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___Int128___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +0 +""" + +Table___Int128___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___Int128___arrayMin__ = r""" +arrayMin(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayMin__ = r""" +a +1 +""" + +Inline___Int128___arrayMax__ = r""" +arrayMax(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayMax__ = r""" +a +3 +""" + +Inline___Int128___arraySum__ = r""" +arraySum(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +6 +""" + +Table___Int128___arraySum__ = r""" +a +6 +""" + +Inline___Int128___arrayAvg__ = r""" +arrayAvg(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +2 +""" + +Table___Int128___arrayAvg__ = r""" +a +2 +""" + +Inline___Int128___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayReduce__max____ = r""" +a +3 +""" + +Inline___Int128___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___Int128___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___Int128___hasAll__toInt128__3____toInt128__2____toInt128__1______ = r""" +hasAll(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___hasAll__toInt128__3____toInt128__2____toInt128__1______ = r""" +a +1 +""" + +Inline___Int128___hasAny__toInt128__2____toInt128__1______ = r""" +hasAny(array(toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___hasAny__toInt128__2____toInt128__1______ = r""" +a +1 +""" + +Inline___Int128___hasSubstr__toInt128__2____toInt128__1______ = r""" +hasSubstr(array(toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +0 +""" + +Table___Int128___hasSubstr__toInt128__2____toInt128__1______ = r""" +a +0 +""" + +Table___Int128___arrayDifference__ = r""" +a +""" + +Table___Int128___arrayCumSum__ = r""" +a +""" + +Table___Int128___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___Int128___arrayElement = r""" +arrayElement(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), 1) +3 +""" + +Table___Int128___arrayElement = r""" +a +3 +""" + +Inline___Int128___arrayPushBack = r""" +arrayPushBack(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), toInt128(\'1\')) +[3,2,1,1] +""" + +Table___Int128___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___Int128___arrayPushFront = r""" +arrayPushFront(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), toInt128(\'1\')) +[1,3,2,1] +""" + +Table___Int128___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___Int128___arrayResize = r""" +arrayResize(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), 1) +[3] +""" + +Table___Int128___arrayResize = r""" +a +[3] +""" + +Inline___Int128___arraySlice = r""" +arraySlice(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), 1) +[3,2,1] +""" + +Table___Int128___arraySlice = r""" +a +[3,2,1] +""" + +Inline___Int128___has = r""" +has(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), NULL) +0 +""" + +Table___Int128___has = r""" +a +0 +""" + +Inline___Int128___indexOf = r""" +indexOf(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), NULL) +0 +""" + +Table___Int128___indexOf = r""" +a +0 +""" + +Inline___Int128___countEqual = r""" +countEqual(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), NULL) +0 +""" + +Table___Int128___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_Int128_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_Int128_on_a_table = r""" +a +1 +""" + +untuple_with_Int128_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_Int128_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_Int128_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_Int128 = r""" +mapAdd(tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\'))), tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_Int128_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_Int128 = r""" +mapSubtract(tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\'))), tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_Int128_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_Int128_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_Int128_on_a_table = r""" +a +1 +""" + +mapKeys_with_Int128_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_Int128_on_a_table = r""" +a +[1,2] +""" + +Inline___Int256___arrayPopBack__ = r""" +arrayPopBack(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2] +""" + +Table___Int256___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___Int256___arrayPopFront__ = r""" +arrayPopFront(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[2,1] +""" + +Table___Int256___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___Int256___arraySort__ = r""" +arraySort(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayReverseSort__ = r""" +arrayReverseSort(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayDistinct__ = r""" +arrayDistinct(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayEnumerate__ = r""" +arrayEnumerate(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,1,1] +""" + +Table___Int256___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___Int256___arrayReverse__ = r""" +arrayReverse(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___Int256___reverse__ = r""" +reverse(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___reverse__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayFlatten__ = r""" +arrayFlatten(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayCompact__ = r""" +arrayCompact(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', [(1, 5)], array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[6] +""" + +Table___Int256___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___Int256___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[5,4,3] +""" + +Table___Int256___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___Int256___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,3,3] +""" + +Table___Int256___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___Int256___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,1,1] +""" + +Table___Int256___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___Int256___arrayConcat__toInt256__3____toInt256__2____toInt256__1_____ = r""" +arrayConcat(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___Int256___arrayConcat__toInt256__3____toInt256__2____toInt256__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___Int256___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1] +""" + +Table___Int256___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___Int256___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[[0,0,0]] +""" + +Table___Int256___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___Int256___arrayZip__toInt256__1_____ = r""" +arrayZip(array(toInt256(\'1\')), array(toInt256(\'3\'))) +[(1,3)] +""" + +Table___Int256___arrayZip__toInt256__1_____ = r""" +a +[(1,1)] +""" + +Inline___Int256___empty__ = r""" +empty(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +0 +""" + +Table___Int256___empty__ = r""" +a +0 +""" + +Inline___Int256___notEmpty__ = r""" +notEmpty(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___notEmpty__ = r""" +a +1 +""" + +Inline___Int256___length__ = r""" +length(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___length__ = r""" +a +3 +""" + +Inline___Int256___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___Int256___arrayUniq__ = r""" +arrayUniq(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayUniq__ = r""" +a +3 +""" + +Inline___Int256___arrayJoin__ = r""" +arrayJoin(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +2 +1 +""" + +Table___Int256___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___Int256___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___Int256___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +0 +""" + +Table___Int256___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___Int256___arrayMin__ = r""" +arrayMin(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayMin__ = r""" +a +1 +""" + +Inline___Int256___arrayMax__ = r""" +arrayMax(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayMax__ = r""" +a +3 +""" + +Inline___Int256___arraySum__ = r""" +arraySum(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +6 +""" + +Table___Int256___arraySum__ = r""" +a +6 +""" + +Inline___Int256___arrayAvg__ = r""" +arrayAvg(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +2 +""" + +Table___Int256___arrayAvg__ = r""" +a +2 +""" + +Inline___Int256___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayReduce__max____ = r""" +a +3 +""" + +Inline___Int256___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___Int256___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___Int256___hasAll__toInt256__3____toInt256__2____toInt256__1______ = r""" +hasAll(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___hasAll__toInt256__3____toInt256__2____toInt256__1______ = r""" +a +1 +""" + +Inline___Int256___hasAny__toInt256__2____toInt256__1______ = r""" +hasAny(array(toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___hasAny__toInt256__2____toInt256__1______ = r""" +a +1 +""" + +Inline___Int256___hasSubstr__toInt256__2____toInt256__1______ = r""" +hasSubstr(array(toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +0 +""" + +Table___Int256___hasSubstr__toInt256__2____toInt256__1______ = r""" +a +0 +""" + +Table___Int256___arrayDifference__ = r""" +a +""" + +Table___Int256___arrayCumSum__ = r""" +a +""" + +Table___Int256___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___Int256___arrayElement = r""" +arrayElement(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), 1) +3 +""" + +Table___Int256___arrayElement = r""" +a +3 +""" + +Inline___Int256___arrayPushBack = r""" +arrayPushBack(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), toInt256(\'1\')) +[3,2,1,1] +""" + +Table___Int256___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___Int256___arrayPushFront = r""" +arrayPushFront(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), toInt256(\'1\')) +[1,3,2,1] +""" + +Table___Int256___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___Int256___arrayResize = r""" +arrayResize(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), 1) +[3] +""" + +Table___Int256___arrayResize = r""" +a +[3] +""" + +Inline___Int256___arraySlice = r""" +arraySlice(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), 1) +[3,2,1] +""" + +Table___Int256___arraySlice = r""" +a +[3,2,1] +""" + +Inline___Int256___has = r""" +has(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), NULL) +0 +""" + +Table___Int256___has = r""" +a +0 +""" + +Inline___Int256___indexOf = r""" +indexOf(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), NULL) +0 +""" + +Table___Int256___indexOf = r""" +a +0 +""" + +Inline___Int256___countEqual = r""" +countEqual(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), NULL) +0 +""" + +Table___Int256___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_Int256_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_Int256_on_a_table = r""" +a +1 +""" + +untuple_with_Int256_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_Int256_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_Int256_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_Int256 = r""" +mapAdd(tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\'))), tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_Int256_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_Int256 = r""" +mapSubtract(tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\'))), tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_Int256_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_Int256_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_Int256_on_a_table = r""" +a +1 +""" + +mapKeys_with_Int256_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_Int256_on_a_table = r""" +a +[1,2] +""" + +Inline___UInt128___arrayPopBack__ = r""" +arrayPopBack(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2] +""" + +Table___UInt128___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___UInt128___arrayPopFront__ = r""" +arrayPopFront(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[2,1] +""" + +Table___UInt128___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___UInt128___arraySort__ = r""" +arraySort(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayReverseSort__ = r""" +arrayReverseSort(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayDistinct__ = r""" +arrayDistinct(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayEnumerate__ = r""" +arrayEnumerate(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,1,1] +""" + +Table___UInt128___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___UInt128___arrayReverse__ = r""" +arrayReverse(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___reverse__ = r""" +reverse(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___reverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayFlatten__ = r""" +arrayFlatten(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayCompact__ = r""" +arrayCompact(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', [(1, 5)], array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[6] +""" + +Table___UInt128___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___UInt128___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[5,4,3] +""" + +Table___UInt128___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___UInt128___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,3,3] +""" + +Table___UInt128___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___UInt128___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,1,1] +""" + +Table___UInt128___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___UInt128___arrayConcat__toUInt128__3____toUInt128__2____toUInt128__1_____ = r""" +arrayConcat(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___UInt128___arrayConcat__toUInt128__3____toUInt128__2____toUInt128__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___UInt128___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1] +""" + +Table___UInt128___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___UInt128___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[[0,0,0]] +""" + +Table___UInt128___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___UInt128___arrayZip__toUInt128__1_____ = r""" +arrayZip(array(toUInt128(\'1\')), array(toUInt128(\'3\'))) +[(1,3)] +""" + +Table___UInt128___arrayZip__toUInt128__1_____ = r""" +a +[(1,1)] +""" + +Inline___UInt128___empty__ = r""" +empty(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +0 +""" + +Table___UInt128___empty__ = r""" +a +0 +""" + +Inline___UInt128___notEmpty__ = r""" +notEmpty(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___notEmpty__ = r""" +a +1 +""" + +Inline___UInt128___length__ = r""" +length(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___length__ = r""" +a +3 +""" + +Inline___UInt128___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___UInt128___arrayUniq__ = r""" +arrayUniq(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayUniq__ = r""" +a +3 +""" + +Inline___UInt128___arrayJoin__ = r""" +arrayJoin(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +2 +1 +""" + +Table___UInt128___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___UInt128___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___UInt128___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +0 +""" + +Table___UInt128___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___UInt128___arrayMin__ = r""" +arrayMin(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayMin__ = r""" +a +1 +""" + +Inline___UInt128___arrayMax__ = r""" +arrayMax(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayMax__ = r""" +a +3 +""" + +Inline___UInt128___arraySum__ = r""" +arraySum(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +6 +""" + +Table___UInt128___arraySum__ = r""" +a +6 +""" + +Inline___UInt128___arrayAvg__ = r""" +arrayAvg(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +2 +""" + +Table___UInt128___arrayAvg__ = r""" +a +2 +""" + +Inline___UInt128___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayReduce__max____ = r""" +a +3 +""" + +Inline___UInt128___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___UInt128___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___UInt128___hasAll__toUInt128__3____toUInt128__2____toUInt128__1______ = r""" +hasAll(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___hasAll__toUInt128__3____toUInt128__2____toUInt128__1______ = r""" +a +1 +""" + +Inline___UInt128___hasAny__toUInt128__2____toUInt128__1______ = r""" +hasAny(array(toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___hasAny__toUInt128__2____toUInt128__1______ = r""" +a +1 +""" + +Inline___UInt128___hasSubstr__toUInt128__2____toUInt128__1______ = r""" +hasSubstr(array(toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +0 +""" + +Table___UInt128___hasSubstr__toUInt128__2____toUInt128__1______ = r""" +a +0 +""" + +Table___UInt128___arrayDifference__ = r""" +a +""" + +Table___UInt128___arrayCumSum__ = r""" +a +""" + +Table___UInt128___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___UInt128___arrayElement = r""" +arrayElement(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), 1) +3 +""" + +Table___UInt128___arrayElement = r""" +a +3 +""" + +Inline___UInt128___arrayPushBack = r""" +arrayPushBack(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), toUInt128(\'1\')) +[3,2,1,1] +""" + +Table___UInt128___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___UInt128___arrayPushFront = r""" +arrayPushFront(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), toUInt128(\'1\')) +[1,3,2,1] +""" + +Table___UInt128___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___UInt128___arrayResize = r""" +arrayResize(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), 1) +[3] +""" + +Table___UInt128___arrayResize = r""" +a +[3] +""" + +Inline___UInt128___arraySlice = r""" +arraySlice(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), 1) +[3,2,1] +""" + +Table___UInt128___arraySlice = r""" +a +[3,2,1] +""" + +Inline___UInt128___has = r""" +has(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), NULL) +0 +""" + +Table___UInt128___has = r""" +a +0 +""" + +Inline___UInt128___indexOf = r""" +indexOf(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), NULL) +0 +""" + +Table___UInt128___indexOf = r""" +a +0 +""" + +Inline___UInt128___countEqual = r""" +countEqual(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), NULL) +0 +""" + +Table___UInt128___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_UInt128_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_UInt128_on_a_table = r""" +a +1 +""" + +untuple_with_UInt128_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_UInt128_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_UInt128_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_UInt128 = r""" +mapAdd(tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\'))), tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_UInt128_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_UInt128 = r""" +mapSubtract(tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\'))), tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_UInt128_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_UInt128_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_UInt128_on_a_table = r""" +a +1 +""" + +mapKeys_with_UInt128_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_UInt128_on_a_table = r""" +a +[1,2] +""" + +Inline___UInt256___arrayPopBack__ = r""" +arrayPopBack(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2] +""" + +Table___UInt256___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___UInt256___arrayPopFront__ = r""" +arrayPopFront(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[2,1] +""" + +Table___UInt256___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___UInt256___arraySort__ = r""" +arraySort(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayReverseSort__ = r""" +arrayReverseSort(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayDistinct__ = r""" +arrayDistinct(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayEnumerate__ = r""" +arrayEnumerate(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,1,1] +""" + +Table___UInt256___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___UInt256___arrayReverse__ = r""" +arrayReverse(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___reverse__ = r""" +reverse(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___reverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayFlatten__ = r""" +arrayFlatten(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayCompact__ = r""" +arrayCompact(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', [(1, 5)], array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[6] +""" + +Table___UInt256___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___UInt256___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[5,4,3] +""" + +Table___UInt256___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___UInt256___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,3,3] +""" + +Table___UInt256___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___UInt256___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,1,1] +""" + +Table___UInt256___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___UInt256___arrayConcat__toUInt256__3____toUInt256__2____toUInt256__1_____ = r""" +arrayConcat(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___UInt256___arrayConcat__toUInt256__3____toUInt256__2____toUInt256__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___UInt256___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1] +""" + +Table___UInt256___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___UInt256___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[[0,0,0]] +""" + +Table___UInt256___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___UInt256___arrayZip__toUInt256__1_____ = r""" +arrayZip(array(toUInt256(\'1\')), array(toUInt256(\'3\'))) +[(1,3)] +""" + +Table___UInt256___arrayZip__toUInt256__1_____ = r""" +a +[(1,1)] +""" + +Inline___UInt256___empty__ = r""" +empty(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +0 +""" + +Table___UInt256___empty__ = r""" +a +0 +""" + +Inline___UInt256___notEmpty__ = r""" +notEmpty(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___notEmpty__ = r""" +a +1 +""" + +Inline___UInt256___length__ = r""" +length(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___length__ = r""" +a +3 +""" + +Inline___UInt256___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___UInt256___arrayUniq__ = r""" +arrayUniq(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayUniq__ = r""" +a +3 +""" + +Inline___UInt256___arrayJoin__ = r""" +arrayJoin(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +2 +1 +""" + +Table___UInt256___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___UInt256___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___UInt256___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +0 +""" + +Table___UInt256___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___UInt256___arrayMin__ = r""" +arrayMin(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayMin__ = r""" +a +1 +""" + +Inline___UInt256___arrayMax__ = r""" +arrayMax(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayMax__ = r""" +a +3 +""" + +Inline___UInt256___arraySum__ = r""" +arraySum(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +6 +""" + +Table___UInt256___arraySum__ = r""" +a +6 +""" + +Inline___UInt256___arrayAvg__ = r""" +arrayAvg(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +2 +""" + +Table___UInt256___arrayAvg__ = r""" +a +2 +""" + +Inline___UInt256___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayReduce__max____ = r""" +a +3 +""" + +Inline___UInt256___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___UInt256___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___UInt256___hasAll__toUInt256__3____toUInt256__2____toUInt256__1______ = r""" +hasAll(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___hasAll__toUInt256__3____toUInt256__2____toUInt256__1______ = r""" +a +1 +""" + +Inline___UInt256___hasAny__toUInt256__2____toUInt256__1______ = r""" +hasAny(array(toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___hasAny__toUInt256__2____toUInt256__1______ = r""" +a +1 +""" + +Inline___UInt256___hasSubstr__toUInt256__2____toUInt256__1______ = r""" +hasSubstr(array(toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +0 +""" + +Table___UInt256___hasSubstr__toUInt256__2____toUInt256__1______ = r""" +a +0 +""" + +Table___UInt256___arrayDifference__ = r""" +a +""" + +Table___UInt256___arrayCumSum__ = r""" +a +""" + +Table___UInt256___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___UInt256___arrayElement = r""" +arrayElement(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), 1) +3 +""" + +Table___UInt256___arrayElement = r""" +a +3 +""" + +Inline___UInt256___arrayPushBack = r""" +arrayPushBack(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), toUInt256(\'1\')) +[3,2,1,1] +""" + +Table___UInt256___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___UInt256___arrayPushFront = r""" +arrayPushFront(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), toUInt256(\'1\')) +[1,3,2,1] +""" + +Table___UInt256___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___UInt256___arrayResize = r""" +arrayResize(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), 1) +[3] +""" + +Table___UInt256___arrayResize = r""" +a +[3] +""" + +Inline___UInt256___arraySlice = r""" +arraySlice(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), 1) +[3,2,1] +""" + +Table___UInt256___arraySlice = r""" +a +[3,2,1] +""" + +Inline___UInt256___has = r""" +has(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), NULL) +0 +""" + +Table___UInt256___has = r""" +a +0 +""" + +Inline___UInt256___indexOf = r""" +indexOf(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), NULL) +0 +""" + +Table___UInt256___indexOf = r""" +a +0 +""" + +Inline___UInt256___countEqual = r""" +countEqual(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), NULL) +0 +""" + +Table___UInt256___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_UInt256_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_UInt256_on_a_table = r""" +a +1 +""" + +untuple_with_UInt256_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_UInt256_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_UInt256_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_UInt256 = r""" +mapAdd(tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\'))), tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_UInt256_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_UInt256 = r""" +mapSubtract(tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\'))), tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_UInt256_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_UInt256_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_UInt256_on_a_table = r""" +a +1 +""" + +mapKeys_with_UInt256_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_UInt256_on_a_table = r""" +a +[1,2] +""" + +Inline___Decimal256_0____arrayPopBack__ = r""" +arrayPopBack(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2] +""" + +Table___Decimal256_0____arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___Decimal256_0____arrayPopFront__ = r""" +arrayPopFront(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[2,1] +""" + +Table___Decimal256_0____arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___Decimal256_0____arraySort__ = r""" +arraySort(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arraySort__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayReverseSort__ = r""" +arrayReverseSort(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayDistinct__ = r""" +arrayDistinct(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayEnumerate__ = r""" +arrayEnumerate(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,1,1] +""" + +Table___Decimal256_0____arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___Decimal256_0____arrayReverse__ = r""" +arrayReverse(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____reverse__ = r""" +reverse(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____reverse__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayFlatten__ = r""" +arrayFlatten(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayCompact__ = r""" +arrayCompact(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', [(1, 5)], array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[6] +""" + +Table___Decimal256_0____arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___Decimal256_0____arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[5,4,3] +""" + +Table___Decimal256_0____arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___Decimal256_0____arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,3,3] +""" + +Table___Decimal256_0____arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___Decimal256_0____arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,1,1] +""" + +Table___Decimal256_0____arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___Decimal256_0____arrayConcat__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0____ = r""" +arrayConcat(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1,3,2,1] +""" + +Table___Decimal256_0____arrayConcat__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___Decimal256_0____arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1] +""" + +Table___Decimal256_0____arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___Decimal256_0____arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[[0,0,0]] +""" + +Table___Decimal256_0____arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___Decimal256_0____arrayZip__toDecimal256__1__0____ = r""" +arrayZip(array(toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0))) +[(1,3)] +""" + +Table___Decimal256_0____arrayZip__toDecimal256__1__0____ = r""" +a +[(1,1)] +""" + +Inline___Decimal256_0____empty__ = r""" +empty(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +0 +""" + +Table___Decimal256_0____empty__ = r""" +a +0 +""" + +Inline___Decimal256_0____notEmpty__ = r""" +notEmpty(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____notEmpty__ = r""" +a +1 +""" + +Inline___Decimal256_0____length__ = r""" +length(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____length__ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___Decimal256_0____arrayUniq__ = r""" +arrayUniq(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____arrayUniq__ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayJoin__ = r""" +arrayJoin(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +2 +1 +""" + +Table___Decimal256_0____arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___Decimal256_0____arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___Decimal256_0____arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +0 +""" + +Table___Decimal256_0____arrayAll_x____x__1__ = r""" +a +0 +""" + +Table___Decimal256_0____arrayMin__ = r""" +a +""" + +Table___Decimal256_0____arrayMax__ = r""" +a +""" + +Table___Decimal256_0____arraySum__ = r""" +a +""" + +Table___Decimal256_0____arrayAvg__ = r""" +a +""" + +Inline___Decimal256_0____arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____arrayReduce__max____ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___Decimal256_0____hasAll__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0_____ = r""" +hasAll(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____hasAll__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0_____ = r""" +a +1 +""" + +Inline___Decimal256_0____hasAny__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +hasAny(array(toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____hasAny__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +a +1 +""" + +Inline___Decimal256_0____hasSubstr__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +hasSubstr(array(toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +0 +""" + +Table___Decimal256_0____hasSubstr__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +a +0 +""" + +Table___Decimal256_0____arrayDifference__ = r""" +a +""" + +Table___Decimal256_0____arrayCumSum__ = r""" +a +""" + +Table___Decimal256_0____arrayCumSumNonNegative__ = r""" +a +""" + +Inline___Decimal256_0____arrayElement = r""" +arrayElement(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), 1) +3 +""" + +Table___Decimal256_0____arrayElement = r""" +a +3 +""" + +Inline___Decimal256_0____arrayPushBack = r""" +arrayPushBack(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), toDecimal256(\'1\', 0)) +[3,2,1,1] +""" + +Table___Decimal256_0____arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___Decimal256_0____arrayPushFront = r""" +arrayPushFront(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), toDecimal256(\'1\', 0)) +[1,3,2,1] +""" + +Table___Decimal256_0____arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___Decimal256_0____arrayResize = r""" +arrayResize(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), 1) +[3] +""" + +Table___Decimal256_0____arrayResize = r""" +a +[3] +""" + +Inline___Decimal256_0____arraySlice = r""" +arraySlice(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), 1) +[3,2,1] +""" + +Table___Decimal256_0____arraySlice = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____has = r""" +has(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), NULL) +0 +""" + +Table___Decimal256_0____has = r""" +a +0 +""" + +Inline___Decimal256_0____indexOf = r""" +indexOf(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), NULL) +0 +""" + +Table___Decimal256_0____indexOf = r""" +a +0 +""" + +Inline___Decimal256_0____countEqual = r""" +countEqual(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), NULL) +0 +""" + +Table___Decimal256_0____countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_Decimal256_0__on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_Decimal256_0__on_a_table = r""" +a +1 +""" + +untuple_with_Decimal256_0__on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_Decimal256_0__on_a_table = r""" +a +2 +""" + +Creating_a_map_with_Decimal256_0__on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_Decimal256_0__on_a_table = r""" +a +""" + +mapSubtract_with_Decimal256_0__on_a_table = r""" +a +""" + +mapPopulateSeries_with_Decimal256_0__on_a_table = r""" +a +""" + +mapContains_with_Decimal256_0__on_a_table = r""" +a +1 +""" + +mapKeys_with_Decimal256_0__on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_Decimal256_0__on_a_table = r""" +a +[1,2] +""" + +I_check_equals_with_Int128 = r""" +equals(toInt128(1), toInt128(1)) equals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +1 0 +""" + +I_check_equals_with_Int256 = r""" +equals(toInt256(1), toInt256(1)) equals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 0 +""" + +I_check_equals_with_UInt128 = r""" +equals(toUInt128(1), toUInt128(1)) equals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +1 0 +""" + +I_check_equals_with_UInt256 = r""" +equals(toUInt256(1), toUInt256(1)) equals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +1 0 +""" + +I_check_notEquals_with_Int128 = r""" +notEquals(toInt128(1), toInt128(1)) notEquals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +0 1 +""" + +I_check_notEquals_with_Int256 = r""" +notEquals(toInt256(1), toInt256(1)) notEquals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +0 1 +""" + +I_check_notEquals_with_UInt128 = r""" +notEquals(toUInt128(1), toUInt128(1)) notEquals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +0 1 +""" + +I_check_notEquals_with_UInt256 = r""" +notEquals(toUInt256(1), toUInt256(1)) notEquals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +0 1 +""" + +I_check_less_with_Int128 = r""" +less(toInt128(1), toInt128(1)) less(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +0 0 +""" + +I_check_less_with_Int256 = r""" +less(toInt256(1), toInt256(1)) less(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +0 0 +""" + +I_check_less_with_UInt128 = r""" +less(toUInt128(1), toUInt128(1)) less(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +0 0 +""" + +I_check_less_with_UInt256 = r""" +less(toUInt256(1), toUInt256(1)) less(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +0 0 +""" + +I_check_greater_with_Int128 = r""" +greater(toInt128(1), toInt128(1)) greater(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +0 1 +""" + +I_check_greater_with_Int256 = r""" +greater(toInt256(1), toInt256(1)) greater(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +0 1 +""" + +I_check_greater_with_UInt128 = r""" +greater(toUInt128(1), toUInt128(1)) greater(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +0 1 +""" + +I_check_greater_with_UInt256 = r""" +greater(toUInt256(1), toUInt256(1)) greater(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +0 1 +""" + +I_check_lessOrEquals_with_Int128 = r""" +lessOrEquals(toInt128(1), toInt128(1)) lessOrEquals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +1 0 +""" + +I_check_lessOrEquals_with_Int256 = r""" +lessOrEquals(toInt256(1), toInt256(1)) lessOrEquals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 0 +""" + +I_check_lessOrEquals_with_UInt128 = r""" +lessOrEquals(toUInt128(1), toUInt128(1)) lessOrEquals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +1 0 +""" + +I_check_lessOrEquals_with_UInt256 = r""" +lessOrEquals(toUInt256(1), toUInt256(1)) lessOrEquals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +1 0 +""" + +I_check_greaterOrEquals_with_Int128 = r""" +greaterOrEquals(toInt128(1), toInt128(1)) greaterOrEquals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +1 1 +""" + +I_check_greaterOrEquals_with_Int256 = r""" +greaterOrEquals(toInt256(1), toInt256(1)) greaterOrEquals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 1 +""" + +I_check_greaterOrEquals_with_UInt128 = r""" +greaterOrEquals(toUInt128(1), toUInt128(1)) greaterOrEquals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +1 1 +""" + +I_check_greaterOrEquals_with_UInt256 = r""" +greaterOrEquals(toUInt256(1), toUInt256(1)) greaterOrEquals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +1 1 +""" + +I_check_the_table_for_the_output_of_equals_with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_equals_with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_equals_with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_equals_with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_less_with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_less_with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_less_with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_less_with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_equals_with_Decimal256 = r""" +equals(toDecimal256(1, 0), toDecimal256(1, 0)) equals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 0 +""" + +I_check_notEquals_with_Decimal256 = r""" +notEquals(toDecimal256(1, 0), toDecimal256(1, 0)) notEquals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 1 +""" + +I_check_less_with_Decimal256 = r""" +less(toDecimal256(1, 0), toDecimal256(1, 0)) less(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 0 +""" + +I_check_greater_with_Decimal256 = r""" +greater(toDecimal256(1, 0), toDecimal256(1, 0)) greater(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 1 +""" + +I_check_lessOrEquals_with_Decimal256 = r""" +lessOrEquals(toDecimal256(1, 0), toDecimal256(1, 0)) lessOrEquals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 0 +""" + +I_check_greaterOrEquals_with_Decimal256 = r""" +greaterOrEquals(toDecimal256(1, 0), toDecimal256(1, 0)) greaterOrEquals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_the_table_for_the_output_of_equals_with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_Decimal256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_less_with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_Decimal256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_Decimal256 = r""" +a +0 +1 +1 +""" + +I_check_exp__with_Int128_using_max_and_min = r""" +round(exp(toInt128(\'170141183460469231731687303715884105727\')), 7) round(exp(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf 0 +""" + +I_check_exp__with_Int256_using_max_and_min = r""" +round(exp(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(exp(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf 0 +""" + +I_check_exp__with_UInt128_using_max_and_min = r""" +round(exp(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(exp(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_exp__with_UInt256_using_max_and_min = r""" +round(exp(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(exp(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_log__with_Int128_using_max_and_min = r""" +round(log(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.0296919 nan +""" + +I_check_log__with_Int256_using_max_and_min = r""" +round(log(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +176.752531 nan +""" + +I_check_log__with_UInt128_using_max_and_min = r""" +round(log(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log(toUInt128(\'0\')), 7) +88.7228391 -inf +""" + +I_check_log__with_UInt256_using_max_and_min = r""" +round(log(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log(toUInt256(\'0\')), 7) +177.4456782 -inf +""" + +I_check_ln__with_Int128_using_max_and_min = r""" +round(log(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.0296919 nan +""" + +I_check_ln__with_Int256_using_max_and_min = r""" +round(log(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +176.752531 nan +""" + +I_check_ln__with_UInt128_using_max_and_min = r""" +round(log(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log(toUInt128(\'0\')), 7) +88.7228391 -inf +""" + +I_check_ln__with_UInt256_using_max_and_min = r""" +round(log(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log(toUInt256(\'0\')), 7) +177.4456782 -inf +""" + +I_check_exp2__with_Int128_using_max_and_min = r""" +round(exp2(toInt128(\'170141183460469231731687303715884105727\')), 7) round(exp2(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf 0 +""" + +I_check_exp2__with_Int256_using_max_and_min = r""" +round(exp2(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(exp2(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf 0 +""" + +I_check_exp2__with_UInt128_using_max_and_min = r""" +round(exp2(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(exp2(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_exp2__with_UInt256_using_max_and_min = r""" +round(exp2(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(exp2(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_log2__with_Int128_using_max_and_min = r""" +round(log2(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log2(toInt128(\'-170141183460469231731687303715884105728\')), 7) +127 nan +""" + +I_check_log2__with_Int256_using_max_and_min = r""" +round(log2(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log2(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +255 nan +""" + +I_check_log2__with_UInt128_using_max_and_min = r""" +round(log2(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log2(toUInt128(\'0\')), 7) +128 -inf +""" + +I_check_log2__with_UInt256_using_max_and_min = r""" +round(log2(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log2(toUInt256(\'0\')), 7) +256 -inf +""" + +I_check_exp10__with_Int128_using_max_and_min = r""" +round(exp10(toInt128(\'170141183460469231731687303715884105727\')), 7) round(exp10(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf 0 +""" + +I_check_exp10__with_Int256_using_max_and_min = r""" +round(exp10(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(exp10(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf 0 +""" + +I_check_exp10__with_UInt128_using_max_and_min = r""" +round(exp10(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(exp10(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_exp10__with_UInt256_using_max_and_min = r""" +round(exp10(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(exp10(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_log10__with_Int128_using_max_and_min = r""" +round(log10(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log10(toInt128(\'-170141183460469231731687303715884105728\')), 7) +38.2308094 nan +""" + +I_check_log10__with_Int256_using_max_and_min = r""" +round(log10(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log10(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +76.7626489 nan +""" + +I_check_log10__with_UInt128_using_max_and_min = r""" +round(log10(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log10(toUInt128(\'0\')), 7) +38.5318394 -inf +""" + +I_check_log10__with_UInt256_using_max_and_min = r""" +round(log10(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log10(toUInt256(\'0\')), 7) +77.0636789 -inf +""" + +I_check_sqrt__with_Int128_using_max_and_min = r""" +round(sqrt(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sqrt(toInt128(\'-170141183460469231731687303715884105728\')), 7) +13043817825332783000 nan +""" + +I_check_sqrt__with_Int256_using_max_and_min = r""" +round(sqrt(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sqrt(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +2.4061596916800453e38 nan +""" + +I_check_sqrt__with_UInt128_using_max_and_min = r""" +round(sqrt(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sqrt(toUInt128(\'0\')), 7) +18446744073709552000 0 +""" + +I_check_sqrt__with_UInt256_using_max_and_min = r""" +round(sqrt(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sqrt(toUInt256(\'0\')), 7) +3.402823669209385e38 0 +""" + +I_check_cbrt__with_Int128_using_max_and_min = r""" +round(cbrt(toInt128(\'170141183460469231731687303715884105727\')), 7) round(cbrt(toInt128(\'-170141183460469231731687303715884105728\')), 7) +5541191377756.637 -5541191377756.637 +""" + +I_check_cbrt__with_Int256_using_max_and_min = r""" +round(cbrt(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(cbrt(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +3.8685626227668134e25 -3.8685626227668134e25 +""" + +I_check_cbrt__with_UInt128_using_max_and_min = r""" +round(cbrt(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(cbrt(toUInt128(\'0\')), 7) +6981463658331.56 0 +""" + +I_check_cbrt__with_UInt256_using_max_and_min = r""" +round(cbrt(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(cbrt(toUInt256(\'0\')), 7) +4.874083481260429e25 0 +""" + +I_check_erf__with_Int128_using_max_and_min = r""" +round(erf(toInt128(\'170141183460469231731687303715884105727\')), 7) round(erf(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1 -1 +""" + +I_check_erf__with_Int256_using_max_and_min = r""" +round(erf(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(erf(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1 -1 +""" + +I_check_erf__with_UInt128_using_max_and_min = r""" +round(erf(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(erf(toUInt128(\'0\')), 7) +1 0 +""" + +I_check_erf__with_UInt256_using_max_and_min = r""" +round(erf(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(erf(toUInt256(\'0\')), 7) +1 0 +""" + +I_check_erfc__with_Int128_using_max_and_min = r""" +round(erfc(toInt128(\'170141183460469231731687303715884105727\')), 7) round(erfc(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0 2 +""" + +I_check_erfc__with_Int256_using_max_and_min = r""" +round(erfc(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(erfc(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +0 2 +""" + +I_check_erfc__with_UInt128_using_max_and_min = r""" +round(erfc(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(erfc(toUInt128(\'0\')), 7) +0 1 +""" + +I_check_erfc__with_UInt256_using_max_and_min = r""" +round(erfc(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(erfc(toUInt256(\'0\')), 7) +0 1 +""" + +I_check_lgamma__with_Int128_using_max_and_min = r""" +round(lgamma(toInt128(\'170141183460469231731687303715884105727\')), 7) round(lgamma(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1.4807334781359624e40 -1.4807334781359624e40 +""" + +I_check_lgamma__with_Int256_using_max_and_min = r""" +round(lgamma(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(lgamma(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1.0175376379095233e79 -1.0175376379095233e79 +""" + +I_check_lgamma__with_UInt128_using_max_and_min = r""" +round(lgamma(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(lgamma(toUInt128(\'0\')), 7) +2.985053532594476e40 inf +""" + +I_check_lgamma__with_UInt256_using_max_and_min = r""" +round(lgamma(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(lgamma(toUInt256(\'0\')), 7) +2.0431013718376458e79 inf +""" + +I_check_tgamma__with_Int128_using_max_and_min = r""" +round(tgamma(toInt128(\'170141183460469231731687303715884105727\')), 7) round(tgamma(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf nan +""" + +I_check_tgamma__with_Int256_using_max_and_min = r""" +round(tgamma(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(tgamma(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf nan +""" + +I_check_tgamma__with_UInt128_using_max_and_min = r""" +round(tgamma(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(tgamma(toUInt128(\'0\')), 7) +inf inf +""" + +I_check_tgamma__with_UInt256_using_max_and_min = r""" +round(tgamma(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(tgamma(toUInt256(\'0\')), 7) +inf inf +""" + +I_check_sin__with_Int128_using_max_and_min = r""" +round(sin(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sin(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0.6233855 -0.6233855 +""" + +I_check_sin__with_Int256_using_max_and_min = r""" +round(sin(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sin(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +0.9751222 -0.9751222 +""" + +I_check_sin__with_UInt128_using_max_and_min = r""" +round(sin(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sin(toUInt128(\'0\')), 7) +0.9748685 0 +""" + +I_check_sin__with_UInt256_using_max_and_min = r""" +round(sin(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sin(toUInt256(\'0\')), 7) +0.4323066 0 +""" + +I_check_cos__with_Int128_using_max_and_min = r""" +round(cos(toInt128(\'170141183460469231731687303715884105727\')), 7) round(cos(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0.7819146 0.7819146 +""" + +I_check_cos__with_Int256_using_max_and_min = r""" +round(cos(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(cos(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +0.2216679 0.2216679 +""" + +I_check_cos__with_UInt128_using_max_and_min = r""" +round(cos(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(cos(toUInt128(\'0\')), 7) +0.222781 1 +""" + +I_check_cos__with_UInt256_using_max_and_min = r""" +round(cos(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(cos(toUInt256(\'0\')), 7) +-0.9017267 1 +""" + +I_check_tan__with_Int128_using_max_and_min = r""" +round(tan(toInt128(\'170141183460469231731687303715884105727\')), 7) round(tan(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0.7972552 -0.7972552 +""" + +I_check_tan__with_Int256_using_max_and_min = r""" +round(tan(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(tan(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +4.3990229 -4.3990229 +""" + +I_check_tan__with_UInt128_using_max_and_min = r""" +round(tan(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(tan(toUInt128(\'0\')), 7) +4.375905 0 +""" + +I_check_tan__with_UInt256_using_max_and_min = r""" +round(tan(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(tan(toUInt256(\'0\')), 7) +-0.4794209 0 +""" + +I_check_asin__with_Int128_using_max_and_min = r""" +round(asin(toInt128(\'170141183460469231731687303715884105727\')), 7) round(asin(toInt128(\'-170141183460469231731687303715884105728\')), 7) +nan nan +""" + +I_check_asin__with_Int256_using_max_and_min = r""" +round(asin(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(asin(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +nan nan +""" + +I_check_asin__with_UInt128_using_max_and_min = r""" +round(asin(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(asin(toUInt128(\'0\')), 7) +nan 0 +""" + +I_check_asin__with_UInt256_using_max_and_min = r""" +round(asin(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(asin(toUInt256(\'0\')), 7) +nan 0 +""" + +I_check_acos__with_Int128_using_max_and_min = r""" +round(acos(toInt128(\'170141183460469231731687303715884105727\')), 7) round(acos(toInt128(\'-170141183460469231731687303715884105728\')), 7) +nan nan +""" + +I_check_acos__with_Int256_using_max_and_min = r""" +round(acos(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(acos(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +nan nan +""" + +I_check_acos__with_UInt128_using_max_and_min = r""" +round(acos(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(acos(toUInt128(\'0\')), 7) +nan 1.5707963 +""" + +I_check_acos__with_UInt256_using_max_and_min = r""" +round(acos(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(acos(toUInt256(\'0\')), 7) +nan 1.5707963 +""" + +I_check_atan__with_Int128_using_max_and_min = r""" +round(atan(toInt128(\'170141183460469231731687303715884105727\')), 7) round(atan(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1.5707963 -1.5707963 +""" + +I_check_atan__with_Int256_using_max_and_min = r""" +round(atan(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(atan(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1.5707963 -1.5707963 +""" + +I_check_atan__with_UInt128_using_max_and_min = r""" +round(atan(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(atan(toUInt128(\'0\')), 7) +1.5707963 0 +""" + +I_check_atan__with_UInt256_using_max_and_min = r""" +round(atan(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(atan(toUInt256(\'0\')), 7) +1.5707963 0 +""" + +I_check_cosh__with_Int128_using_max_and_min = r""" +round(cosh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(cosh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf inf +""" + +I_check_cosh__with_Int256_using_max_and_min = r""" +round(cosh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(cosh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf inf +""" + +I_check_cosh__with_UInt128_using_max_and_min = r""" +round(cosh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(cosh(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_cosh__with_UInt256_using_max_and_min = r""" +round(cosh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(cosh(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_acosh__with_Int128_using_max_and_min = r""" +round(acosh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(acosh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.7228391 nan +""" + +I_check_acosh__with_Int256_using_max_and_min = r""" +round(acosh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(acosh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +177.4456782 nan +""" + +I_check_acosh__with_UInt128_using_max_and_min = r""" +round(acosh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(acosh(toUInt128(\'0\')), 7) +89.4159863 nan +""" + +I_check_acosh__with_UInt256_using_max_and_min = r""" +round(acosh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(acosh(toUInt256(\'0\')), 7) +178.1388254 nan +""" + +I_check_sinh__with_Int128_using_max_and_min = r""" +round(sinh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sinh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf -inf +""" + +I_check_sinh__with_Int256_using_max_and_min = r""" +round(sinh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sinh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf -inf +""" + +I_check_sinh__with_UInt128_using_max_and_min = r""" +round(sinh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sinh(toUInt128(\'0\')), 7) +inf 0 +""" + +I_check_sinh__with_UInt256_using_max_and_min = r""" +round(sinh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sinh(toUInt256(\'0\')), 7) +inf 0 +""" + +I_check_asinh__with_Int128_using_max_and_min = r""" +round(asinh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(asinh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.7228391 -88.7228391 +""" + +I_check_asinh__with_Int256_using_max_and_min = r""" +round(asinh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(asinh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +177.4456782 -177.4456782 +""" + +I_check_asinh__with_UInt128_using_max_and_min = r""" +round(asinh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(asinh(toUInt128(\'0\')), 7) +89.4159863 0 +""" + +I_check_asinh__with_UInt256_using_max_and_min = r""" +round(asinh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(asinh(toUInt256(\'0\')), 7) +178.1388254 0 +""" + +I_check_tanh__with_Int128_using_max_and_min = r""" +round(tanh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(tanh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1 -1 +""" + +I_check_tanh__with_Int256_using_max_and_min = r""" +round(tanh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(tanh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1 -1 +""" + +I_check_tanh__with_UInt128_using_max_and_min = r""" +round(tanh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(tanh(toUInt128(\'0\')), 7) +1 0 +""" + +I_check_tanh__with_UInt256_using_max_and_min = r""" +round(tanh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(tanh(toUInt256(\'0\')), 7) +1 0 +""" + +I_check_atanh__with_Int128_using_max_and_min = r""" +round(atanh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(atanh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +nan nan +""" + +I_check_atanh__with_Int256_using_max_and_min = r""" +round(atanh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(atanh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +nan nan +""" + +I_check_atanh__with_UInt128_using_max_and_min = r""" +round(atanh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(atanh(toUInt128(\'0\')), 7) +nan 0 +""" + +I_check_atanh__with_UInt256_using_max_and_min = r""" +round(atanh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(atanh(toUInt256(\'0\')), 7) +nan 0 +""" + +I_check_log1p__with_Int128_using_max_and_min = r""" +round(log1p(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log1p(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.0296919 nan +""" + +I_check_log1p__with_Int256_using_max_and_min = r""" +round(log1p(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log1p(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +176.752531 nan +""" + +I_check_log1p__with_UInt128_using_max_and_min = r""" +round(log1p(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log1p(toUInt128(\'0\')), 7) +88.7228391 0 +""" + +I_check_log1p__with_UInt256_using_max_and_min = r""" +round(log1p(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log1p(toUInt256(\'0\')), 7) +177.4456782 0 +""" + +I_check_sign__with_Int128_using_max_and_min = r""" +round(sign(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sign(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1 -1 +""" + +I_check_sign__with_Int256_using_max_and_min = r""" +round(sign(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sign(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1 -1 +""" + +I_check_sign__with_UInt128_using_max_and_min = r""" +round(sign(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sign(toUInt128(\'0\')), 7) +1 0 +""" + +I_check_sign__with_UInt256_using_max_and_min = r""" +round(sign(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sign(toUInt256(\'0\')), 7) +1 0 +""" + +I_check_the_outputs_of_exp__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_exp__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_log__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp2__with_Int128 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_exp2__with_Int256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_exp2__with_UInt128 = r""" +a +0 +1 +2 +""" + +I_check_the_outputs_of_exp2__with_UInt256 = r""" +a +0 +1 +2 +""" + +I_check_the_outputs_of_log2__with_Int128 = r""" +a +0 +0 +127 +""" + +I_check_the_outputs_of_log2__with_Int256 = r""" +a +0 +0 +255 +""" + +I_check_the_outputs_of_log2__with_UInt128 = r""" +a +0 +0 +128 +""" + +I_check_the_outputs_of_log2__with_UInt256 = r""" +a +0 +0 +256 +""" + +I_check_the_outputs_of_exp10__with_Int128 = r""" +a +0 +0 +10 +""" + +I_check_the_outputs_of_exp10__with_Int256 = r""" +a +0 +0 +10 +""" + +I_check_the_outputs_of_exp10__with_UInt128 = r""" +a +0 +1 +10 +""" + +I_check_the_outputs_of_exp10__with_UInt256 = r""" +a +0 +1 +10 +""" + +I_check_the_outputs_of_log10__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log10__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log10__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log10__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sqrt__with_Int128 = r""" +a +0 +1 +13043817825332783000 +""" + +I_check_the_outputs_of_sqrt__with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_sqrt__with_UInt128 = r""" +a +0 +1 +18446744073709552000 +""" + +I_check_the_outputs_of_sqrt__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erf__with_Int128 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_erf__with_Int256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_erf__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erf__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erfc__with_Int128 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_erfc__with_Int256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_erfc__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erfc__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_lgamma__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_lgamma__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_lgamma__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_lgamma__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tgamma__with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tgamma__with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tgamma__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tgamma__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_sin__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sin__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sin__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sin__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cos__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tan__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cosh__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_acosh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tanh__with_Int128 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_tanh__with_Int256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_tanh__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tanh__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_atanh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atanh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atanh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atanh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sign__with_Int128 = r""" +a +-1 +1 +1 +""" + +I_check_the_outputs_of_sign__with_Int256 = r""" +a +-1 +1 +1 +""" + +I_check_the_outputs_of_sign__with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_outputs_of_sign__with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_exp__with_Decimal256_using_max_and_min = r""" +round(exp(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(exp(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf 0 +""" + +I_check_log__with_Decimal256_using_max_and_min = r""" +round(log(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +172.693882 nan +""" + +I_check_ln__with_Decimal256_using_max_and_min = r""" +round(log(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +172.693882 nan +""" + +I_check_exp2__with_Decimal256_using_max_and_min = r""" +round(exp2(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(exp2(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf 0 +""" + +I_check_log2__with_Decimal256_using_max_and_min = r""" +round(log2(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log2(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +249.1446071 nan +""" + +I_check_exp10__with_Decimal256_using_max_and_min = r""" +round(exp10(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(exp10(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf 0 +""" + +I_check_log10__with_Decimal256_using_max_and_min = r""" +round(log10(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log10(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +75 nan +""" + +I_check_sqrt__with_Decimal256_using_max_and_min = r""" +round(sqrt(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sqrt(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +3.1622776601683794e37 nan +""" + +I_check_cbrt__with_Decimal256_using_max_and_min = r""" +round(cbrt(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(cbrt(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1e25 -1e25 +""" + +I_check_erf__with_Decimal256_using_max_and_min = r""" +round(erf(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(erf(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1 -1 +""" + +I_check_erfc__with_Decimal256_using_max_and_min = r""" +round(erfc(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(erfc(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +0 2 +""" + +I_check_lgamma__with_Decimal256_using_max_and_min = r""" +round(lgamma(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(lgamma(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1.7169388197455342e77 -1.7169388197455342e77 +""" + +I_check_tgamma__with_Decimal256_using_max_and_min = r""" +round(tgamma(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(tgamma(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf nan +""" + +I_check_sin__with_Decimal256_using_max_and_min = r""" +round(sin(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sin(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +0.6633998 -0.6633998 +""" + +I_check_cos__with_Decimal256_using_max_and_min = r""" +round(cos(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(cos(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +-0.7482652 -0.7482652 +""" + +I_check_tan__with_Decimal256_using_max_and_min = r""" +round(tan(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(tan(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +-0.8865838 0.8865838 +""" + +I_check_asin__with_Decimal256_using_max_and_min = r""" +round(asin(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(asin(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +nan nan +""" + +I_check_acos__with_Decimal256_using_max_and_min = r""" +round(acos(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(acos(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +nan nan +""" + +I_check_atan__with_Decimal256_using_max_and_min = r""" +round(atan(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(atan(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1.5707963 -1.5707963 +""" + +I_check_cosh__with_Decimal256_using_max_and_min = r""" +round(cosh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(cosh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf inf +""" + +I_check_acosh__with_Decimal256_using_max_and_min = r""" +round(acosh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(acosh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +173.3870292 nan +""" + +I_check_sinh__with_Decimal256_using_max_and_min = r""" +round(sinh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sinh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf -inf +""" + +I_check_asinh__with_Decimal256_using_max_and_min = r""" +round(asinh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(asinh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +173.3870292 -173.3870292 +""" + +I_check_tanh__with_Decimal256_using_max_and_min = r""" +round(tanh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(tanh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1 -1 +""" + +I_check_atanh__with_Decimal256_using_max_and_min = r""" +round(atanh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(atanh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +nan nan +""" + +I_check_log1p__with_Decimal256_using_max_and_min = r""" +round(log1p(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log1p(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +172.693882 nan +""" + +I_check_sign__with_Decimal256_using_max_and_min = r""" +round(sign(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sign(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1 -1 +""" + +I_check_the_outputs_of_exp__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp2__with_Decimal256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_log2__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp10__with_Decimal256 = r""" +a +0 +0 +10 +""" + +I_check_the_outputs_of_log10__with_Decimal256 = r""" +a +0 +0 +75 +""" + +I_check_the_outputs_of_sqrt__with_Decimal256 = r""" +a +0 +1 +31622776601683794000000000000000000000 +""" + +I_check_the_outputs_of_cbrt__with_Decimal256 = r""" +a +-10000000000000000000000000 +1 +10000000000000000000000000 +""" + +I_check_the_outputs_of_erf__with_Decimal256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_erfc__with_Decimal256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_lgamma__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tgamma__with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_sin__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tanh__with_Decimal256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_atanh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sign__with_Decimal256 = r""" +a +-1 +1 +1 +""" + +I_check_ceil_with_Int128_using_min_and_max_values = r""" +ceil(toInt128(\'-170141183460469231731687303715884105728\')) ceil(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_ceil_with_Int256_using_min_and_max_values = r""" +ceil(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) ceil(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_ceil_with_UInt128_using_min_and_max_values = r""" +ceil(toUInt128(\'0\')) ceil(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_ceil_with_UInt256_using_min_and_max_values = r""" +ceil(toUInt256(\'0\')) ceil(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_floor_with_Int128_using_min_and_max_values = r""" +floor(toInt128(\'-170141183460469231731687303715884105728\')) floor(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_floor_with_Int256_using_min_and_max_values = r""" +floor(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) floor(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_floor_with_UInt128_using_min_and_max_values = r""" +floor(toUInt128(\'0\')) floor(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_floor_with_UInt256_using_min_and_max_values = r""" +floor(toUInt256(\'0\')) floor(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_trunc_with_Int128_using_min_and_max_values = r""" +trunc(toInt128(\'-170141183460469231731687303715884105728\')) trunc(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_trunc_with_Int256_using_min_and_max_values = r""" +trunc(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) trunc(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_trunc_with_UInt128_using_min_and_max_values = r""" +trunc(toUInt128(\'0\')) trunc(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_trunc_with_UInt256_using_min_and_max_values = r""" +trunc(toUInt256(\'0\')) trunc(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_round_with_Int128_using_min_and_max_values = r""" +round(toInt128(\'-170141183460469231731687303715884105728\')) round(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_round_with_Int256_using_min_and_max_values = r""" +round(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) round(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_round_with_UInt128_using_min_and_max_values = r""" +round(toUInt128(\'0\')) round(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_round_with_UInt256_using_min_and_max_values = r""" +round(toUInt256(\'0\')) round(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_roundBankers_with_Int128_using_min_and_max_values = r""" +roundBankers(toInt128(\'-170141183460469231731687303715884105728\')) roundBankers(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_roundBankers_with_Int256_using_min_and_max_values = r""" +roundBankers(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) roundBankers(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_roundBankers_with_UInt128_using_min_and_max_values = r""" +roundBankers(toUInt128(\'0\')) roundBankers(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_roundBankers_with_UInt256_using_min_and_max_values = r""" +roundBankers(toUInt256(\'0\')) roundBankers(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_roundDuration_with_Int128_using_min_and_max_values = r""" +roundDuration(toInt128(\'-170141183460469231731687303715884105728\')) roundDuration(toInt128(\'170141183460469231731687303715884105727\')) +0 36000 +""" + +I_check_roundDuration_with_Int256_using_min_and_max_values = r""" +roundDuration(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) roundDuration(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +0 36000 +""" + +I_check_roundDuration_with_UInt128_using_min_and_max_values = r""" +roundDuration(toUInt128(\'0\')) roundDuration(toUInt128(\'340282366920938463463374607431768211455\')) +0 36000 +""" + +I_check_roundDuration_with_UInt256_using_min_and_max_values = r""" +roundDuration(toUInt256(\'0\')) roundDuration(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 36000 +""" + +I_check_roundAge_with_Int128_using_min_and_max_values = r""" +roundAge(toInt128(\'-170141183460469231731687303715884105728\')) roundAge(toInt128(\'170141183460469231731687303715884105727\')) +0 55 +""" + +I_check_roundAge_with_Int256_using_min_and_max_values = r""" +roundAge(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) roundAge(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +0 55 +""" + +I_check_roundAge_with_UInt128_using_min_and_max_values = r""" +roundAge(toUInt128(\'0\')) roundAge(toUInt128(\'340282366920938463463374607431768211455\')) +0 55 +""" + +I_check_roundAge_with_UInt256_using_min_and_max_values = r""" +roundAge(toUInt256(\'0\')) roundAge(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 55 +""" + +I_select_the_output_of_ceil_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_ceil_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_ceil_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_ceil_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_floor_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_floor_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_floor_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_floor_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_trunc_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_trunc_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_trunc_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_trunc_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_round_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_round_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_round_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_round_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_roundBankers_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_roundBankers_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_roundBankers_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_roundBankers_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_roundDuration_with_Int128_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundDuration_with_Int256_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundDuration_with_UInt128_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundDuration_with_UInt256_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundAge_with_Int128_from_the_table = r""" +a +0 +17 +55 +""" + +I_select_the_output_of_roundAge_with_Int256_from_the_table = r""" +a +0 +17 +55 +""" + +I_select_the_output_of_roundAge_with_UInt128_from_the_table = r""" +a +0 +17 +55 +""" + +I_select_the_output_of_roundAge_with_UInt256_from_the_table = r""" +a +0 +17 +55 +""" + +I_check_ceil_with_Decimal256_using_min_and_max_values = r""" +ceil(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) ceil(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_floor_with_Decimal256_using_min_and_max_values = r""" +floor(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) floor(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_trunc_with_Decimal256_using_min_and_max_values = r""" +trunc(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) trunc(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_round_with_Decimal256_using_min_and_max_values = r""" +round(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) round(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_roundBankers_with_Decimal256_using_min_and_max_values = r""" +roundBankers(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) roundBankers(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_ceil_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_floor_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_trunc_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_round_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_roundBankers_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_bitAnd_with_Int128 = r""" +bitAnd(toInt128(1), 1) bitAnd(toInt128(\'170141183460469231731687303715884105727\'), 1) bitAnd(toInt128(\'-170141183460469231731687303715884105728\'), 1) +1 1 0 +""" + +I_check_bitAnd_with_Int256 = r""" +bitAnd(toInt256(1), 1) bitAnd(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitAnd(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +1 1 0 +""" + +I_check_bitAnd_with_UInt128 = r""" +bitAnd(toUInt128(1), 1) bitAnd(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitAnd(toUInt128(\'0\'), 1) +1 1 0 +""" + +I_check_bitAnd_with_UInt256 = r""" +bitAnd(toUInt256(1), 1) bitAnd(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitAnd(toUInt256(\'0\'), 1) +1 1 0 +""" + +I_check_bitOr_with_Int128 = r""" +bitOr(toInt128(1), 1) bitOr(toInt128(\'170141183460469231731687303715884105727\'), 1) bitOr(toInt128(\'-170141183460469231731687303715884105728\'), 1) +1 170141183460469231731687303715884105727 -170141183460469231731687303715884105727 +""" + +I_check_bitOr_with_Int256 = r""" +bitOr(toInt256(1), 1) bitOr(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitOr(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +1 57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_bitOr_with_UInt128 = r""" +bitOr(toUInt128(1), 1) bitOr(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitOr(toUInt128(\'0\'), 1) +1 340282366920938463463374607431768211455 1 +""" + +I_check_bitOr_with_UInt256 = r""" +bitOr(toUInt256(1), 1) bitOr(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitOr(toUInt256(\'0\'), 1) +1 115792089237316195423570985008687907853269984665640564039457584007913129639935 1 +""" + +I_check_bitXor_with_Int128 = r""" +bitXor(toInt128(1), 1) bitXor(toInt128(\'170141183460469231731687303715884105727\'), 1) bitXor(toInt128(\'-170141183460469231731687303715884105728\'), 1) +0 170141183460469231731687303715884105726 -170141183460469231731687303715884105727 +""" + +I_check_bitXor_with_Int256 = r""" +bitXor(toInt256(1), 1) bitXor(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitXor(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +0 57896044618658097711785492504343953926634992332820282019728792003956564819966 -57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_bitXor_with_UInt128 = r""" +bitXor(toUInt128(1), 1) bitXor(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitXor(toUInt128(\'0\'), 1) +0 340282366920938463463374607431768211454 1 +""" + +I_check_bitXor_with_UInt256 = r""" +bitXor(toUInt256(1), 1) bitXor(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitXor(toUInt256(\'0\'), 1) +0 115792089237316195423570985008687907853269984665640564039457584007913129639934 1 +""" + +I_check_bitShiftLeft_with_Int128 = r""" +bitShiftLeft(toInt128(1), 1) bitShiftLeft(toInt128(\'170141183460469231731687303715884105727\'), 1) bitShiftLeft(toInt128(\'-170141183460469231731687303715884105728\'), 1) +2 -2 0 +""" + +I_check_bitShiftLeft_with_Int256 = r""" +bitShiftLeft(toInt256(1), 1) bitShiftLeft(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitShiftLeft(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +2 -2 0 +""" + +I_check_bitShiftLeft_with_UInt128 = r""" +bitShiftLeft(toUInt128(1), 1) bitShiftLeft(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitShiftLeft(toUInt128(\'0\'), 1) +2 340282366920938463463374607431768211454 0 +""" + +I_check_bitShiftLeft_with_UInt256 = r""" +bitShiftLeft(toUInt256(1), 1) bitShiftLeft(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitShiftLeft(toUInt256(\'0\'), 1) +2 115792089237316195423570985008687907853269984665640564039457584007913129639934 0 +""" + +I_check_bitShiftRight_with_Int128 = r""" +bitShiftRight(toInt128(1), 1) bitShiftRight(toInt128(\'170141183460469231731687303715884105727\'), 1) bitShiftRight(toInt128(\'-170141183460469231731687303715884105728\'), 1) +0 85070591730234615865843651857942052863 -85070591730234615865843651857942052864 +""" + +I_check_bitShiftRight_with_Int256 = r""" +bitShiftRight(toInt256(1), 1) bitShiftRight(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitShiftRight(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +0 28948022309329048855892746252171976963317496166410141009864396001978282409983 -28948022309329048855892746252171976963317496166410141009864396001978282409984 +""" + +I_check_bitShiftRight_with_UInt128 = r""" +bitShiftRight(toUInt128(1), 1) bitShiftRight(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitShiftRight(toUInt128(\'0\'), 1) +0 170141183460469231731687303715884105727 0 +""" + +I_check_bitShiftRight_with_UInt256 = r""" +bitShiftRight(toUInt256(1), 1) bitShiftRight(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitShiftRight(toUInt256(\'0\'), 1) +0 57896044618658097711785492504343953926634992332820282019728792003956564819967 0 +""" + +Check_bitNot_with_Int128 = r""" +bitNot(toInt128(1)) bitNot(toInt128(\'170141183460469231731687303715884105727\')) bitNot(toInt128(\'-170141183460469231731687303715884105728\')) +-2 -170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +Check_bitNot_with_Int256 = r""" +bitNot(toInt256(1)) bitNot(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) bitNot(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +-2 -57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +Check_bitNot_with_UInt128 = r""" +bitNot(toUInt128(1)) bitNot(toUInt128(\'340282366920938463463374607431768211455\')) bitNot(toUInt128(\'0\')) +340282366920938463463374607431768211454 0 340282366920938463463374607431768211455 +""" + +Check_bitNot_with_UInt256 = r""" +bitNot(toUInt256(1)) bitNot(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) bitNot(toUInt256(\'0\')) +115792089237316195423570985008687907853269984665640564039457584007913129639934 0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +Check_bitCount_with_Int128 = r""" +bitCount(toInt128(1)) bitCount(toInt128(\'170141183460469231731687303715884105727\')) bitCount(toInt128(\'-170141183460469231731687303715884105728\')) +1 64 0 +""" + +Check_bitCount_with_Int256 = r""" +bitCount(toInt256(1)) bitCount(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) bitCount(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 64 0 +""" + +Check_bitCount_with_UInt128 = r""" +bitCount(toUInt128(1)) bitCount(toUInt128(\'340282366920938463463374607431768211455\')) bitCount(toUInt128(\'0\')) +1 64 0 +""" + +Check_bitCount_with_UInt256 = r""" +bitCount(toUInt256(1)) bitCount(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) bitCount(toUInt256(\'0\')) +1 64 0 +""" + +I_check_the_table_with_values_of_bitAnd_and_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitAnd_and_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitAnd_and_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitAnd_and_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitOr_and_Int128 = r""" +a +-170141183460469231731687303715884105727 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_with_values_of_bitOr_and_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_with_values_of_bitOr_and_UInt128 = r""" +a +1 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_with_values_of_bitOr_and_UInt256 = r""" +a +1 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_with_values_of_bitXor_and_Int128 = r""" +a +-170141183460469231731687303715884105727 +0 +170141183460469231731687303715884105726 +""" + +I_check_the_table_with_values_of_bitXor_and_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +0 +57896044618658097711785492504343953926634992332820282019728792003956564819966 +""" + +I_check_the_table_with_values_of_bitXor_and_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211454 +""" + +I_check_the_table_with_values_of_bitXor_and_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_Int128 = r""" +a +-2 +0 +2 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_Int256 = r""" +a +-2 +0 +2 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_UInt128 = r""" +a +0 +2 +340282366920938463463374607431768211454 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_UInt256 = r""" +a +0 +2 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_Int128 = r""" +a +-85070591730234615865843651857942052864 +0 +85070591730234615865843651857942052863 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_Int256 = r""" +a +-28948022309329048855892746252171976963317496166410141009864396001978282409984 +0 +28948022309329048855892746252171976963317496166410141009864396001978282409983 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_UInt128 = r""" +a +0 +0 +170141183460469231731687303715884105727 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_UInt256 = r""" +a +0 +0 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_with_values_of_bitNot_and_Int128 = r""" +a +-170141183460469231731687303715884105728 +-2 +170141183460469231731687303715884105727 +""" + +I_check_the_table_with_values_of_bitNot_and_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +-2 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_with_values_of_bitNot_and_UInt128 = r""" +a +0 +340282366920938463463374607431768211454 +340282366920938463463374607431768211455 +""" + +I_check_the_table_with_values_of_bitNot_and_UInt256 = r""" +a +0 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_with_values_of_bitCount_and_Int128 = r""" +a +0 +1 +64 +""" + +I_check_the_table_with_values_of_bitCount_and_Int256 = r""" +a +0 +1 +64 +""" + +I_check_the_table_with_values_of_bitCount_and_UInt128 = r""" +a +0 +1 +64 +""" + +I_check_the_table_with_values_of_bitCount_and_UInt256 = r""" +a +0 +1 +64 +""" + +I_check_isNull__with_Int128_using_min_and_max = r""" +isNull(toInt128(\'-170141183460469231731687303715884105728\')) isNull(toInt128(\'170141183460469231731687303715884105727\')) +0 0 +""" + +I_check_isNull__with_Int256_using_min_and_max = r""" +isNull(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) isNull(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +0 0 +""" + +I_check_isNull__with_UInt128_using_min_and_max = r""" +isNull(toUInt128(\'0\')) isNull(toUInt128(\'340282366920938463463374607431768211455\')) +0 0 +""" + +I_check_isNull__with_UInt256_using_min_and_max = r""" +isNull(toUInt256(\'0\')) isNull(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 0 +""" + +I_check_isNotNull__with_Int128_using_min_and_max = r""" +isNotNull(toInt128(\'-170141183460469231731687303715884105728\')) isNotNull(toInt128(\'170141183460469231731687303715884105727\')) +1 1 +""" + +I_check_isNotNull__with_Int256_using_min_and_max = r""" +isNotNull(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) isNotNull(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +1 1 +""" + +I_check_isNotNull__with_UInt128_using_min_and_max = r""" +isNotNull(toUInt128(\'0\')) isNotNull(toUInt128(\'340282366920938463463374607431768211455\')) +1 1 +""" + +I_check_isNotNull__with_UInt256_using_min_and_max = r""" +isNotNull(toUInt256(\'0\')) isNotNull(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +1 1 +""" + +I_check_coalesce__with_Int128_using_min_and_max = r""" +coalesce(toInt128(\'-170141183460469231731687303715884105728\')) coalesce(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_coalesce__with_Int256_using_min_and_max = r""" +coalesce(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) coalesce(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_coalesce__with_UInt128_using_min_and_max = r""" +coalesce(toUInt128(\'0\')) coalesce(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_coalesce__with_UInt256_using_min_and_max = r""" +coalesce(toUInt256(\'0\')) coalesce(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_assumeNotNull__with_Int128_using_min_and_max = r""" +assumeNotNull(toInt128(\'-170141183460469231731687303715884105728\')) assumeNotNull(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_assumeNotNull__with_Int256_using_min_and_max = r""" +assumeNotNull(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) assumeNotNull(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_assumeNotNull__with_UInt128_using_min_and_max = r""" +assumeNotNull(toUInt128(\'0\')) assumeNotNull(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_assumeNotNull__with_UInt256_using_min_and_max = r""" +assumeNotNull(toUInt256(\'0\')) assumeNotNull(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_toNullable__with_Int128_using_min_and_max = r""" +toNullable(toInt128(\'-170141183460469231731687303715884105728\')) toNullable(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_toNullable__with_Int256_using_min_and_max = r""" +toNullable(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) toNullable(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_toNullable__with_UInt128_using_min_and_max = r""" +toNullable(toUInt128(\'0\')) toNullable(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_toNullable__with_UInt256_using_min_and_max = r""" +toNullable(toUInt256(\'0\')) toNullable(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_ifNull_1__with_Int128_using_min_and_max = r""" +ifNull(1, toInt128(\'-170141183460469231731687303715884105728\')) ifNull(1, toInt128(\'170141183460469231731687303715884105727\')) +1 1 +""" + +I_check_ifNull_1__with_Int256_using_min_and_max = r""" +ifNull(1, toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) ifNull(1, toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +1 1 +""" + +I_check_ifNull_1__with_UInt128_using_min_and_max = r""" +ifNull(1, toUInt128(\'0\')) ifNull(1, toUInt128(\'340282366920938463463374607431768211455\')) +1 1 +""" + +I_check_ifNull_1__with_UInt256_using_min_and_max = r""" +ifNull(1, toUInt256(\'0\')) ifNull(1, toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +1 1 +""" + +I_check_nullIf_1__with_Int128_using_min_and_max = r""" +nullIf(1, toInt128(\'-170141183460469231731687303715884105728\')) nullIf(1, toInt128(\'170141183460469231731687303715884105727\')) +1 1 +""" + +I_check_nullIf_1__with_Int256_using_min_and_max = r""" +nullIf(1, toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) nullIf(1, toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +1 1 +""" + +I_check_nullIf_1__with_UInt128_using_min_and_max = r""" +nullIf(1, toUInt128(\'0\')) nullIf(1, toUInt128(\'340282366920938463463374607431768211455\')) +1 1 +""" + +I_check_nullIf_1__with_UInt256_using_min_and_max = r""" +nullIf(1, toUInt256(\'0\')) nullIf(1, toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +1 1 +""" + +I_check_isNull__with_Int128_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNull__with_Int256_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNull__with_UInt128_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNull__with_UInt256_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNotNull__with_Int128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_isNotNull__with_Int256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_isNotNull__with_UInt128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_isNotNull__with_UInt256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_coalesce__with_Int128_on_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_coalesce__with_Int256_on_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_coalesce__with_UInt128_on_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_coalesce__with_UInt256_on_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_assumeNotNull__with_Int128_on_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_assumeNotNull__with_Int256_on_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_assumeNotNull__with_UInt128_on_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_assumeNotNull__with_UInt256_on_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_toNullable__with_Int128_on_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_toNullable__with_Int256_on_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_toNullable__with_UInt128_on_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_toNullable__with_UInt256_on_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_ifNull_1__with_Int128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_ifNull_1__with_Int256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_ifNull_1__with_UInt128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_ifNull_1__with_UInt256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_nullIf_1__with_Int128_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_nullIf_1__with_Int256_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_nullIf_1__with_UInt128_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_nullIf_1__with_UInt256_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_isNull__with_Decimal256_using_min_and_max = r""" +isNull(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) isNull(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 0 +""" + +I_check_isNotNull__with_Decimal256_using_min_and_max = r""" +isNotNull(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) isNotNull(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_coalesce__with_Decimal256_using_min_and_max = r""" +coalesce(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) coalesce(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_assumeNotNull__with_Decimal256_using_min_and_max = r""" +assumeNotNull(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) assumeNotNull(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_toNullable__with_Decimal256_using_min_and_max = r""" +toNullable(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) toNullable(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_ifNull_1__with_Decimal256_using_min_and_max = r""" +ifNull(1, toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) ifNull(1, toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_nullIf_1__with_Decimal256_using_min_and_max = r""" +nullIf(1, toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) nullIf(1, toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_isNull__with_Decimal256_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNotNull__with_Decimal256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_coalesce__with_Decimal256_on_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_assumeNotNull__with_Decimal256_on_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_toNullable__with_Decimal256_on_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_ifNull_1__with_Decimal256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_nullIf_1__with_Decimal256_on_the_table = r""" +a +1 +1 +\N +""" + diff --git a/tests/testflows/extended_precision_data_types/snapshots/common.py.tests.pre22.3.snapshot b/tests/testflows/extended_precision_data_types/snapshots/common.py.tests.pre22.3.snapshot new file mode 100644 index 00000000000..17f7fc2d202 --- /dev/null +++ b/tests/testflows/extended_precision_data_types/snapshots/common.py.tests.pre22.3.snapshot @@ -0,0 +1,6286 @@ +I_check_plus_with_Int128_max_and_min_value = r""" +round(plus(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(plus(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +-170141183460469231731687303715884105728 -170141183460469231731687303715884105727 +""" + +I_check_plus_with_Int256_max_and_min_value = r""" +round(plus(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(plus(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 -57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_plus_with_UInt128_max_and_min_value = r""" +round(plus(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(plus(toUInt128(\'0\'), toUInt128(1)), 7) +0 1 +""" + +I_check_plus_with_UInt256_max_and_min_value = r""" +round(plus(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(plus(toUInt256(\'0\'), toUInt256(1)), 7) +0 1 +""" + +I_check_minus_with_Int128_max_and_min_value = r""" +round(minus(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(minus(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105726 170141183460469231731687303715884105727 +""" + +I_check_minus_with_Int256_max_and_min_value = r""" +round(minus(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(minus(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819966 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_minus_with_UInt128_max_and_min_value = r""" +round(minus(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(minus(toUInt128(\'0\'), toUInt128(1)), 7) +-2 -1 +""" + +I_check_minus_with_UInt256_max_and_min_value = r""" +round(minus(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(minus(toUInt256(\'0\'), toUInt256(1)), 7) +-2 -1 +""" + +I_check_multiply_with_Int128_max_and_min_value = r""" +round(multiply(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(multiply(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_multiply_with_Int256_max_and_min_value = r""" +round(multiply(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(multiply(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_multiply_with_UInt128_max_and_min_value = r""" +round(multiply(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(multiply(toUInt128(\'0\'), toUInt128(1)), 7) +340282366920938463463374607431768211455 0 +""" + +I_check_multiply_with_UInt256_max_and_min_value = r""" +round(multiply(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(multiply(toUInt256(\'0\'), toUInt256(1)), 7) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_intDiv_with_Int128_max_and_min_value = r""" +round(intDiv(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(intDiv(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_intDiv_with_Int256_max_and_min_value = r""" +round(intDiv(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(intDiv(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_intDiv_with_UInt128_max_and_min_value = r""" +round(intDiv(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(intDiv(toUInt128(\'0\'), toUInt128(1)), 7) +340282366920938463463374607431768211455 0 +""" + +I_check_intDiv_with_UInt256_max_and_min_value = r""" +round(intDiv(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(intDiv(toUInt256(\'0\'), toUInt256(1)), 7) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_intDivOrZero_with_Int128_max_and_min_value = r""" +round(intDivOrZero(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(intDivOrZero(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_intDivOrZero_with_Int256_max_and_min_value = r""" +round(intDivOrZero(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(intDivOrZero(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_intDivOrZero_with_UInt128_max_and_min_value = r""" +round(intDivOrZero(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(intDivOrZero(toUInt128(\'0\'), toUInt128(1)), 7) +340282366920938463463374607431768211455 0 +""" + +I_check_intDivOrZero_with_UInt256_max_and_min_value = r""" +round(intDivOrZero(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(intDivOrZero(toUInt256(\'0\'), toUInt256(1)), 7) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_modulo_with_Int128_max_and_min_value = r""" +round(modulo(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(modulo(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +0 0 +""" + +I_check_modulo_with_Int256_max_and_min_value = r""" +round(modulo(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(modulo(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +0 0 +""" + +I_check_modulo_with_UInt128_max_and_min_value = r""" +round(modulo(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(modulo(toUInt128(\'0\'), toUInt128(1)), 7) +0 0 +""" + +I_check_modulo_with_UInt256_max_and_min_value = r""" +round(modulo(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(modulo(toUInt256(\'0\'), toUInt256(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_Int128_max_and_min_value = r""" +round(moduloOrZero(toInt128(\'170141183460469231731687303715884105727\'), toInt128(1)), 7) round(moduloOrZero(toInt128(\'-170141183460469231731687303715884105728\'), toInt128(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_Int256_max_and_min_value = r""" +round(moduloOrZero(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(1)), 7) round(moduloOrZero(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), toInt256(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_UInt128_max_and_min_value = r""" +round(moduloOrZero(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(1)), 7) round(moduloOrZero(toUInt128(\'0\'), toUInt128(1)), 7) +0 0 +""" + +I_check_moduloOrZero_with_UInt256_max_and_min_value = r""" +round(moduloOrZero(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(1)), 7) round(moduloOrZero(toUInt256(\'0\'), toUInt256(1)), 7) +0 0 +""" + +I_check_negate_with_Int128_max_and_min_value = r""" +negate(toInt128(\'170141183460469231731687303715884105727\')) negate(toInt128(\'-170141183460469231731687303715884105728\')) +-170141183460469231731687303715884105727 -170141183460469231731687303715884105728 +""" + +I_check_negate_with_Int256_max_and_min_value = r""" +negate(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) negate(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_negate_with_UInt128_max_and_min_value = r""" +negate(toUInt128(\'340282366920938463463374607431768211455\')) negate(toUInt128(\'0\')) +1 0 +""" + +I_check_negate_with_UInt256_max_and_min_value = r""" +negate(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) negate(toUInt256(\'0\')) +1 0 +""" + +I_check_abs_with_Int128_max_and_min_value = r""" +abs(toInt128(\'170141183460469231731687303715884105727\')) abs(toInt128(\'-170141183460469231731687303715884105728\')) +170141183460469231731687303715884105727 170141183460469231731687303715884105728 +""" + +I_check_abs_with_Int256_max_and_min_value = r""" +abs(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) abs(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +57896044618658097711785492504343953926634992332820282019728792003956564819967 57896044618658097711785492504343953926634992332820282019728792003956564819968 +""" + +I_check_abs_with_UInt128_max_and_min_value = r""" +abs(toUInt128(\'340282366920938463463374607431768211455\')) abs(toUInt128(\'0\')) +340282366920938463463374607431768211455 0 +""" + +I_check_abs_with_UInt256_max_and_min_value = r""" +abs(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) abs(toUInt256(\'0\')) +115792089237316195423570985008687907853269984665640564039457584007913129639935 0 +""" + +I_check_the_table_output_of_plus_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +-170141183460469231731687303715884105727 +2 +""" + +I_check_the_table_output_of_plus_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +2 +""" + +I_check_the_table_output_of_plus_with_UInt128 = r""" +a +0 +1 +2 +""" + +I_check_the_table_output_of_plus_with_UInt256 = r""" +a +0 +1 +2 +""" + +I_check_the_table_output_of_minus_with_Int128 = r""" +a +0 +170141183460469231731687303715884105726 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_minus_with_Int256 = r""" +a +0 +57896044618658097711785492504343953926634992332820282019728792003956564819966 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_minus_with_UInt128 = r""" +a +0 +340282366920938463463374607431768211454 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_minus_with_UInt256 = r""" +a +0 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_multiply_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_multiply_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_multiply_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_multiply_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_intDiv_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_intDiv_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_intDiv_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_intDiv_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_intDivOrZero_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_intDivOrZero_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_intDivOrZero_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_intDivOrZero_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_modulo_with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_modulo_with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_modulo_with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_modulo_with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_moduloOrZero_with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_table_output_of_negate_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +-170141183460469231731687303715884105727 +-1 +""" + +I_check_the_table_output_of_negate_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +-1 +""" + +I_check_the_table_output_of_negate_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_negate_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_abs_with_Int128 = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_output_of_abs_with_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_output_of_abs_with_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_abs_with_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_output_of_gcd_with_Int128 = r""" +a +1 +""" + +I_check_the_table_output_of_gcd_with_Int256 = r""" +a +1 +""" + +I_check_the_table_output_of_gcd_with_UInt128 = r""" +a +1 +1 +""" + +I_check_the_table_output_of_gcd_with_UInt256 = r""" +a +1 +1 +""" + +I_check_the_table_output_of_lcm_with_Int128 = r""" +a +1 +""" + +I_check_the_table_output_of_lcm_with_Int256 = r""" +a +1 +""" + +I_check_the_table_output_of_lcm_with_UInt128 = r""" +a +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_output_of_lcm_with_UInt256 = r""" +a +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_for_output_of_negate_with_Decimal256 = r""" +a +-1 +""" + +I_check_the_table_for_output_of_abs_with_Decimal256 = r""" +a +1 +""" + +Inline___Int128___arrayPopBack__ = r""" +arrayPopBack(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2] +""" + +Table___Int128___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___Int128___arrayPopFront__ = r""" +arrayPopFront(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[2,1] +""" + +Table___Int128___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___Int128___arraySort__ = r""" +arraySort(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayReverseSort__ = r""" +arrayReverseSort(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayDistinct__ = r""" +arrayDistinct(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayEnumerate__ = r""" +arrayEnumerate(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,1,1] +""" + +Table___Int128___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___Int128___arrayReverse__ = r""" +arrayReverse(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___Int128___reverse__ = r""" +reverse(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1,2,3] +""" + +Table___Int128___reverse__ = r""" +a +[1,2,3] +""" + +Inline___Int128___arrayFlatten__ = r""" +arrayFlatten(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayCompact__ = r""" +arrayCompact(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1] +""" + +Table___Int128___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___Int128___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', array((1, 5)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[6] +""" + +Table___Int128___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___Int128___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[5,4,3] +""" + +Table___Int128___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___Int128___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,3,3] +""" + +Table___Int128___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___Int128___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,1,1] +""" + +Table___Int128___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___Int128___arrayConcat__toInt128__3____toInt128__2____toInt128__1_____ = r""" +arrayConcat(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___Int128___arrayConcat__toInt128__3____toInt128__2____toInt128__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___Int128___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[1] +""" + +Table___Int128___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___Int128___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +[[0,0,0]] +""" + +Table___Int128___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___Int128___arrayZip__toInt128__1_____ = r""" +arrayZip(array(toInt128(\'1\')), array(toInt128(\'3\'))) +[(1,3)] +""" + +Table___Int128___arrayZip__toInt128__1_____ = r""" +a +[(1,1)] +""" + +Inline___Int128___empty__ = r""" +empty(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +0 +""" + +Table___Int128___empty__ = r""" +a +0 +""" + +Inline___Int128___notEmpty__ = r""" +notEmpty(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___notEmpty__ = r""" +a +1 +""" + +Inline___Int128___length__ = r""" +length(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___length__ = r""" +a +3 +""" + +Inline___Int128___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___Int128___arrayUniq__ = r""" +arrayUniq(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayUniq__ = r""" +a +3 +""" + +Inline___Int128___arrayJoin__ = r""" +arrayJoin(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +2 +1 +""" + +Table___Int128___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___Int128___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___Int128___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +0 +""" + +Table___Int128___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___Int128___arrayMin__ = r""" +arrayMin(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayMin__ = r""" +a +1 +""" + +Inline___Int128___arrayMax__ = r""" +arrayMax(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayMax__ = r""" +a +3 +""" + +Inline___Int128___arraySum__ = r""" +arraySum(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +6 +""" + +Table___Int128___arraySum__ = r""" +a +6 +""" + +Inline___Int128___arrayAvg__ = r""" +arrayAvg(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +2 +""" + +Table___Int128___arrayAvg__ = r""" +a +2 +""" + +Inline___Int128___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayReduce__max____ = r""" +a +3 +""" + +Inline___Int128___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +3 +""" + +Table___Int128___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___Int128___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___Int128___hasAll__toInt128__3____toInt128__2____toInt128__1______ = r""" +hasAll(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___hasAll__toInt128__3____toInt128__2____toInt128__1______ = r""" +a +1 +""" + +Inline___Int128___hasAny__toInt128__2____toInt128__1______ = r""" +hasAny(array(toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +1 +""" + +Table___Int128___hasAny__toInt128__2____toInt128__1______ = r""" +a +1 +""" + +Inline___Int128___hasSubstr__toInt128__2____toInt128__1______ = r""" +hasSubstr(array(toInt128(\'2\'), toInt128(\'1\')), array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\'))) +0 +""" + +Table___Int128___hasSubstr__toInt128__2____toInt128__1______ = r""" +a +0 +""" + +Table___Int128___arrayDifference__ = r""" +a +""" + +Table___Int128___arrayCumSum__ = r""" +a +""" + +Table___Int128___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___Int128___arrayElement = r""" +arrayElement(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), 1) +3 +""" + +Table___Int128___arrayElement = r""" +a +3 +""" + +Inline___Int128___arrayPushBack = r""" +arrayPushBack(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), toInt128(\'1\')) +[3,2,1,1] +""" + +Table___Int128___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___Int128___arrayPushFront = r""" +arrayPushFront(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), toInt128(\'1\')) +[1,3,2,1] +""" + +Table___Int128___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___Int128___arrayResize = r""" +arrayResize(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), 1) +[3] +""" + +Table___Int128___arrayResize = r""" +a +[3] +""" + +Inline___Int128___arraySlice = r""" +arraySlice(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), 1) +[3,2,1] +""" + +Table___Int128___arraySlice = r""" +a +[3,2,1] +""" + +Inline___Int128___has = r""" +has(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), NULL) +0 +""" + +Table___Int128___has = r""" +a +0 +""" + +Inline___Int128___indexOf = r""" +indexOf(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), NULL) +0 +""" + +Table___Int128___indexOf = r""" +a +0 +""" + +Inline___Int128___countEqual = r""" +countEqual(array(toInt128(\'3\'), toInt128(\'2\'), toInt128(\'1\')), NULL) +0 +""" + +Table___Int128___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_Int128_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_Int128_on_a_table = r""" +a +1 +""" + +untuple_with_Int128_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_Int128_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_Int128_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_Int128 = r""" +mapAdd(tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\'))), tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_Int128_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_Int128 = r""" +mapSubtract(tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\'))), tuple(array(toInt128(\'1\'), toInt128(\'2\')), array(toInt128(\'1\'), toInt128(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_Int128_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_Int128_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_Int128_on_a_table = r""" +a +1 +""" + +mapKeys_with_Int128_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_Int128_on_a_table = r""" +a +[1,2] +""" + +Inline___Int256___arrayPopBack__ = r""" +arrayPopBack(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2] +""" + +Table___Int256___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___Int256___arrayPopFront__ = r""" +arrayPopFront(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[2,1] +""" + +Table___Int256___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___Int256___arraySort__ = r""" +arraySort(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayReverseSort__ = r""" +arrayReverseSort(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayDistinct__ = r""" +arrayDistinct(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayEnumerate__ = r""" +arrayEnumerate(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,1,1] +""" + +Table___Int256___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___Int256___arrayReverse__ = r""" +arrayReverse(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___Int256___reverse__ = r""" +reverse(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1,2,3] +""" + +Table___Int256___reverse__ = r""" +a +[1,2,3] +""" + +Inline___Int256___arrayFlatten__ = r""" +arrayFlatten(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayCompact__ = r""" +arrayCompact(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1] +""" + +Table___Int256___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___Int256___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', array((1, 5)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[6] +""" + +Table___Int256___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___Int256___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[5,4,3] +""" + +Table___Int256___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___Int256___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,3,3] +""" + +Table___Int256___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___Int256___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,1,1] +""" + +Table___Int256___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___Int256___arrayConcat__toInt256__3____toInt256__2____toInt256__1_____ = r""" +arrayConcat(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___Int256___arrayConcat__toInt256__3____toInt256__2____toInt256__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___Int256___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[1] +""" + +Table___Int256___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___Int256___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +[[0,0,0]] +""" + +Table___Int256___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___Int256___arrayZip__toInt256__1_____ = r""" +arrayZip(array(toInt256(\'1\')), array(toInt256(\'3\'))) +[(1,3)] +""" + +Table___Int256___arrayZip__toInt256__1_____ = r""" +a +[(1,1)] +""" + +Inline___Int256___empty__ = r""" +empty(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +0 +""" + +Table___Int256___empty__ = r""" +a +0 +""" + +Inline___Int256___notEmpty__ = r""" +notEmpty(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___notEmpty__ = r""" +a +1 +""" + +Inline___Int256___length__ = r""" +length(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___length__ = r""" +a +3 +""" + +Inline___Int256___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___Int256___arrayUniq__ = r""" +arrayUniq(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayUniq__ = r""" +a +3 +""" + +Inline___Int256___arrayJoin__ = r""" +arrayJoin(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +2 +1 +""" + +Table___Int256___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___Int256___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___Int256___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +0 +""" + +Table___Int256___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___Int256___arrayMin__ = r""" +arrayMin(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayMin__ = r""" +a +1 +""" + +Inline___Int256___arrayMax__ = r""" +arrayMax(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayMax__ = r""" +a +3 +""" + +Inline___Int256___arraySum__ = r""" +arraySum(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +6 +""" + +Table___Int256___arraySum__ = r""" +a +6 +""" + +Inline___Int256___arrayAvg__ = r""" +arrayAvg(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +2 +""" + +Table___Int256___arrayAvg__ = r""" +a +2 +""" + +Inline___Int256___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayReduce__max____ = r""" +a +3 +""" + +Inline___Int256___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +3 +""" + +Table___Int256___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___Int256___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___Int256___hasAll__toInt256__3____toInt256__2____toInt256__1______ = r""" +hasAll(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___hasAll__toInt256__3____toInt256__2____toInt256__1______ = r""" +a +1 +""" + +Inline___Int256___hasAny__toInt256__2____toInt256__1______ = r""" +hasAny(array(toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +1 +""" + +Table___Int256___hasAny__toInt256__2____toInt256__1______ = r""" +a +1 +""" + +Inline___Int256___hasSubstr__toInt256__2____toInt256__1______ = r""" +hasSubstr(array(toInt256(\'2\'), toInt256(\'1\')), array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\'))) +0 +""" + +Table___Int256___hasSubstr__toInt256__2____toInt256__1______ = r""" +a +0 +""" + +Table___Int256___arrayDifference__ = r""" +a +""" + +Table___Int256___arrayCumSum__ = r""" +a +""" + +Table___Int256___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___Int256___arrayElement = r""" +arrayElement(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), 1) +3 +""" + +Table___Int256___arrayElement = r""" +a +3 +""" + +Inline___Int256___arrayPushBack = r""" +arrayPushBack(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), toInt256(\'1\')) +[3,2,1,1] +""" + +Table___Int256___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___Int256___arrayPushFront = r""" +arrayPushFront(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), toInt256(\'1\')) +[1,3,2,1] +""" + +Table___Int256___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___Int256___arrayResize = r""" +arrayResize(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), 1) +[3] +""" + +Table___Int256___arrayResize = r""" +a +[3] +""" + +Inline___Int256___arraySlice = r""" +arraySlice(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), 1) +[3,2,1] +""" + +Table___Int256___arraySlice = r""" +a +[3,2,1] +""" + +Inline___Int256___has = r""" +has(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), NULL) +0 +""" + +Table___Int256___has = r""" +a +0 +""" + +Inline___Int256___indexOf = r""" +indexOf(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), NULL) +0 +""" + +Table___Int256___indexOf = r""" +a +0 +""" + +Inline___Int256___countEqual = r""" +countEqual(array(toInt256(\'3\'), toInt256(\'2\'), toInt256(\'1\')), NULL) +0 +""" + +Table___Int256___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_Int256_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_Int256_on_a_table = r""" +a +1 +""" + +untuple_with_Int256_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_Int256_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_Int256_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_Int256 = r""" +mapAdd(tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\'))), tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_Int256_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_Int256 = r""" +mapSubtract(tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\'))), tuple(array(toInt256(\'1\'), toInt256(\'2\')), array(toInt256(\'1\'), toInt256(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_Int256_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_Int256_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_Int256_on_a_table = r""" +a +1 +""" + +mapKeys_with_Int256_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_Int256_on_a_table = r""" +a +[1,2] +""" + +Inline___UInt128___arrayPopBack__ = r""" +arrayPopBack(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2] +""" + +Table___UInt128___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___UInt128___arrayPopFront__ = r""" +arrayPopFront(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[2,1] +""" + +Table___UInt128___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___UInt128___arraySort__ = r""" +arraySort(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayReverseSort__ = r""" +arrayReverseSort(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayDistinct__ = r""" +arrayDistinct(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayEnumerate__ = r""" +arrayEnumerate(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,1,1] +""" + +Table___UInt128___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___UInt128___arrayReverse__ = r""" +arrayReverse(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___reverse__ = r""" +reverse(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1,2,3] +""" + +Table___UInt128___reverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt128___arrayFlatten__ = r""" +arrayFlatten(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayCompact__ = r""" +arrayCompact(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1] +""" + +Table___UInt128___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___UInt128___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', array((1, 5)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[6] +""" + +Table___UInt128___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___UInt128___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[5,4,3] +""" + +Table___UInt128___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___UInt128___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,3,3] +""" + +Table___UInt128___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___UInt128___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,1,1] +""" + +Table___UInt128___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___UInt128___arrayConcat__toUInt128__3____toUInt128__2____toUInt128__1_____ = r""" +arrayConcat(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___UInt128___arrayConcat__toUInt128__3____toUInt128__2____toUInt128__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___UInt128___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[1] +""" + +Table___UInt128___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___UInt128___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +[[0,0,0]] +""" + +Table___UInt128___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___UInt128___arrayZip__toUInt128__1_____ = r""" +arrayZip(array(toUInt128(\'1\')), array(toUInt128(\'3\'))) +[(1,3)] +""" + +Table___UInt128___arrayZip__toUInt128__1_____ = r""" +a +[(1,1)] +""" + +Inline___UInt128___empty__ = r""" +empty(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +0 +""" + +Table___UInt128___empty__ = r""" +a +0 +""" + +Inline___UInt128___notEmpty__ = r""" +notEmpty(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___notEmpty__ = r""" +a +1 +""" + +Inline___UInt128___length__ = r""" +length(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___length__ = r""" +a +3 +""" + +Inline___UInt128___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___UInt128___arrayUniq__ = r""" +arrayUniq(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayUniq__ = r""" +a +3 +""" + +Inline___UInt128___arrayJoin__ = r""" +arrayJoin(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +2 +1 +""" + +Table___UInt128___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___UInt128___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___UInt128___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +0 +""" + +Table___UInt128___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___UInt128___arrayMin__ = r""" +arrayMin(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayMin__ = r""" +a +1 +""" + +Inline___UInt128___arrayMax__ = r""" +arrayMax(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayMax__ = r""" +a +3 +""" + +Inline___UInt128___arraySum__ = r""" +arraySum(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +6 +""" + +Table___UInt128___arraySum__ = r""" +a +6 +""" + +Inline___UInt128___arrayAvg__ = r""" +arrayAvg(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +2 +""" + +Table___UInt128___arrayAvg__ = r""" +a +2 +""" + +Inline___UInt128___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayReduce__max____ = r""" +a +3 +""" + +Inline___UInt128___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +3 +""" + +Table___UInt128___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___UInt128___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___UInt128___hasAll__toUInt128__3____toUInt128__2____toUInt128__1______ = r""" +hasAll(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___hasAll__toUInt128__3____toUInt128__2____toUInt128__1______ = r""" +a +1 +""" + +Inline___UInt128___hasAny__toUInt128__2____toUInt128__1______ = r""" +hasAny(array(toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +1 +""" + +Table___UInt128___hasAny__toUInt128__2____toUInt128__1______ = r""" +a +1 +""" + +Inline___UInt128___hasSubstr__toUInt128__2____toUInt128__1______ = r""" +hasSubstr(array(toUInt128(\'2\'), toUInt128(\'1\')), array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\'))) +0 +""" + +Table___UInt128___hasSubstr__toUInt128__2____toUInt128__1______ = r""" +a +0 +""" + +Table___UInt128___arrayDifference__ = r""" +a +""" + +Table___UInt128___arrayCumSum__ = r""" +a +""" + +Table___UInt128___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___UInt128___arrayElement = r""" +arrayElement(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), 1) +3 +""" + +Table___UInt128___arrayElement = r""" +a +3 +""" + +Inline___UInt128___arrayPushBack = r""" +arrayPushBack(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), toUInt128(\'1\')) +[3,2,1,1] +""" + +Table___UInt128___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___UInt128___arrayPushFront = r""" +arrayPushFront(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), toUInt128(\'1\')) +[1,3,2,1] +""" + +Table___UInt128___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___UInt128___arrayResize = r""" +arrayResize(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), 1) +[3] +""" + +Table___UInt128___arrayResize = r""" +a +[3] +""" + +Inline___UInt128___arraySlice = r""" +arraySlice(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), 1) +[3,2,1] +""" + +Table___UInt128___arraySlice = r""" +a +[3,2,1] +""" + +Inline___UInt128___has = r""" +has(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), NULL) +0 +""" + +Table___UInt128___has = r""" +a +0 +""" + +Inline___UInt128___indexOf = r""" +indexOf(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), NULL) +0 +""" + +Table___UInt128___indexOf = r""" +a +0 +""" + +Inline___UInt128___countEqual = r""" +countEqual(array(toUInt128(\'3\'), toUInt128(\'2\'), toUInt128(\'1\')), NULL) +0 +""" + +Table___UInt128___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_UInt128_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_UInt128_on_a_table = r""" +a +1 +""" + +untuple_with_UInt128_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_UInt128_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_UInt128_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_UInt128 = r""" +mapAdd(tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\'))), tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_UInt128_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_UInt128 = r""" +mapSubtract(tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\'))), tuple(array(toUInt128(\'1\'), toUInt128(\'2\')), array(toUInt128(\'1\'), toUInt128(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_UInt128_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_UInt128_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_UInt128_on_a_table = r""" +a +1 +""" + +mapKeys_with_UInt128_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_UInt128_on_a_table = r""" +a +[1,2] +""" + +Inline___UInt256___arrayPopBack__ = r""" +arrayPopBack(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2] +""" + +Table___UInt256___arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___UInt256___arrayPopFront__ = r""" +arrayPopFront(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[2,1] +""" + +Table___UInt256___arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___UInt256___arraySort__ = r""" +arraySort(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arraySort__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayReverseSort__ = r""" +arrayReverseSort(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayDistinct__ = r""" +arrayDistinct(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayEnumerate__ = r""" +arrayEnumerate(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,1,1] +""" + +Table___UInt256___arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___UInt256___arrayReverse__ = r""" +arrayReverse(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___reverse__ = r""" +reverse(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1,2,3] +""" + +Table___UInt256___reverse__ = r""" +a +[1,2,3] +""" + +Inline___UInt256___arrayFlatten__ = r""" +arrayFlatten(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayCompact__ = r""" +arrayCompact(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1] +""" + +Table___UInt256___arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___UInt256___arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', array((1, 5)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[6] +""" + +Table___UInt256___arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___UInt256___arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[5,4,3] +""" + +Table___UInt256___arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___UInt256___arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,3,3] +""" + +Table___UInt256___arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___UInt256___arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,1,1] +""" + +Table___UInt256___arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___UInt256___arrayConcat__toUInt256__3____toUInt256__2____toUInt256__1_____ = r""" +arrayConcat(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[3,2,1,3,2,1] +""" + +Table___UInt256___arrayConcat__toUInt256__3____toUInt256__2____toUInt256__1_____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___UInt256___arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[1] +""" + +Table___UInt256___arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___UInt256___arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +[[0,0,0]] +""" + +Table___UInt256___arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___UInt256___arrayZip__toUInt256__1_____ = r""" +arrayZip(array(toUInt256(\'1\')), array(toUInt256(\'3\'))) +[(1,3)] +""" + +Table___UInt256___arrayZip__toUInt256__1_____ = r""" +a +[(1,1)] +""" + +Inline___UInt256___empty__ = r""" +empty(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +0 +""" + +Table___UInt256___empty__ = r""" +a +0 +""" + +Inline___UInt256___notEmpty__ = r""" +notEmpty(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___notEmpty__ = r""" +a +1 +""" + +Inline___UInt256___length__ = r""" +length(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___length__ = r""" +a +3 +""" + +Inline___UInt256___arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___UInt256___arrayUniq__ = r""" +arrayUniq(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayUniq__ = r""" +a +3 +""" + +Inline___UInt256___arrayJoin__ = r""" +arrayJoin(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +2 +1 +""" + +Table___UInt256___arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___UInt256___arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___UInt256___arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +0 +""" + +Table___UInt256___arrayAll_x____x__1__ = r""" +a +0 +""" + +Inline___UInt256___arrayMin__ = r""" +arrayMin(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayMin__ = r""" +a +1 +""" + +Inline___UInt256___arrayMax__ = r""" +arrayMax(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayMax__ = r""" +a +3 +""" + +Inline___UInt256___arraySum__ = r""" +arraySum(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +6 +""" + +Table___UInt256___arraySum__ = r""" +a +6 +""" + +Inline___UInt256___arrayAvg__ = r""" +arrayAvg(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +2 +""" + +Table___UInt256___arrayAvg__ = r""" +a +2 +""" + +Inline___UInt256___arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayReduce__max____ = r""" +a +3 +""" + +Inline___UInt256___arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +3 +""" + +Table___UInt256___arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___UInt256___arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___UInt256___hasAll__toUInt256__3____toUInt256__2____toUInt256__1______ = r""" +hasAll(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___hasAll__toUInt256__3____toUInt256__2____toUInt256__1______ = r""" +a +1 +""" + +Inline___UInt256___hasAny__toUInt256__2____toUInt256__1______ = r""" +hasAny(array(toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +1 +""" + +Table___UInt256___hasAny__toUInt256__2____toUInt256__1______ = r""" +a +1 +""" + +Inline___UInt256___hasSubstr__toUInt256__2____toUInt256__1______ = r""" +hasSubstr(array(toUInt256(\'2\'), toUInt256(\'1\')), array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\'))) +0 +""" + +Table___UInt256___hasSubstr__toUInt256__2____toUInt256__1______ = r""" +a +0 +""" + +Table___UInt256___arrayDifference__ = r""" +a +""" + +Table___UInt256___arrayCumSum__ = r""" +a +""" + +Table___UInt256___arrayCumSumNonNegative__ = r""" +a +""" + +Inline___UInt256___arrayElement = r""" +arrayElement(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), 1) +3 +""" + +Table___UInt256___arrayElement = r""" +a +3 +""" + +Inline___UInt256___arrayPushBack = r""" +arrayPushBack(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), toUInt256(\'1\')) +[3,2,1,1] +""" + +Table___UInt256___arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___UInt256___arrayPushFront = r""" +arrayPushFront(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), toUInt256(\'1\')) +[1,3,2,1] +""" + +Table___UInt256___arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___UInt256___arrayResize = r""" +arrayResize(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), 1) +[3] +""" + +Table___UInt256___arrayResize = r""" +a +[3] +""" + +Inline___UInt256___arraySlice = r""" +arraySlice(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), 1) +[3,2,1] +""" + +Table___UInt256___arraySlice = r""" +a +[3,2,1] +""" + +Inline___UInt256___has = r""" +has(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), NULL) +0 +""" + +Table___UInt256___has = r""" +a +0 +""" + +Inline___UInt256___indexOf = r""" +indexOf(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), NULL) +0 +""" + +Table___UInt256___indexOf = r""" +a +0 +""" + +Inline___UInt256___countEqual = r""" +countEqual(array(toUInt256(\'3\'), toUInt256(\'2\'), toUInt256(\'1\')), NULL) +0 +""" + +Table___UInt256___countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_UInt256_on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_UInt256_on_a_table = r""" +a +1 +""" + +untuple_with_UInt256_on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_UInt256_on_a_table = r""" +a +2 +""" + +Creating_a_map_with_UInt256_on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_UInt256 = r""" +mapAdd(tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\'))), tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\')))) +([1,2],[2,4]) +""" + +mapAdd_with_UInt256_on_a_table = r""" +a +([1,2],[2,4]) +""" + +mapSubtract_with_UInt256 = r""" +mapSubtract(tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\'))), tuple(array(toUInt256(\'1\'), toUInt256(\'2\')), array(toUInt256(\'1\'), toUInt256(\'2\')))) +([1,2],[0,0]) +""" + +mapSubtract_with_UInt256_on_a_table = r""" +a +([1,2],[0,0]) +""" + +mapPopulateSeries_with_UInt256_on_a_table = r""" +a +([1,2,3,4,5],[1,2,3,0,0]) +""" + +mapContains_with_UInt256_on_a_table = r""" +a +1 +""" + +mapKeys_with_UInt256_on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_UInt256_on_a_table = r""" +a +[1,2] +""" + +Inline___Decimal256_0____arrayPopBack__ = r""" +arrayPopBack(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2] +""" + +Table___Decimal256_0____arrayPopBack__ = r""" +a +[3,2] +""" + +Inline___Decimal256_0____arrayPopFront__ = r""" +arrayPopFront(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[2,1] +""" + +Table___Decimal256_0____arrayPopFront__ = r""" +a +[2,1] +""" + +Inline___Decimal256_0____arraySort__ = r""" +arraySort(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arraySort__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayReverseSort__ = r""" +arrayReverseSort(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayReverseSort__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayDistinct__ = r""" +arrayDistinct(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayDistinct__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayEnumerate__ = r""" +arrayEnumerate(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arrayEnumerate__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayEnumerateDense__ = r""" +arrayEnumerateDense(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arrayEnumerateDense__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayEnumerateUniq__ = r""" +arrayEnumerateUniq(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,1,1] +""" + +Table___Decimal256_0____arrayEnumerateUniq__ = r""" +a +[1,1,1] +""" + +Inline___Decimal256_0____arrayReverse__ = r""" +arrayReverse(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____arrayReverse__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____reverse__ = r""" +reverse(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1,2,3] +""" + +Table___Decimal256_0____reverse__ = r""" +a +[1,2,3] +""" + +Inline___Decimal256_0____arrayFlatten__ = r""" +arrayFlatten(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayFlatten__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayCompact__ = r""" +arrayCompact(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1] +""" + +Table___Decimal256_0____arrayCompact__ = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____arrayReduceInRanges__sum_____1__5____ = r""" +arrayReduceInRanges(\'sum\', array((1, 5)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[6] +""" + +Table___Decimal256_0____arrayReduceInRanges__sum_____1__5____ = r""" +a +[6] +""" + +Inline___Decimal256_0____arrayMap_x_____x___2___ = r""" +arrayMap(lambda(tuple(x), plus(x, 2)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[5,4,3] +""" + +Table___Decimal256_0____arrayMap_x_____x___2___ = r""" +a +[5,4,3] +""" + +Inline___Decimal256_0____arrayFill_x____x_3__ = r""" +arrayFill(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,3,3] +""" + +Table___Decimal256_0____arrayFill_x____x_3__ = r""" +a +[3,3,3] +""" + +Inline___Decimal256_0____arrayReverseFill_x____x_3__ = r""" +arrayReverseFill(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,1,1] +""" + +Table___Decimal256_0____arrayReverseFill_x____x_3__ = r""" +a +[3,1,1] +""" + +Inline___Decimal256_0____arrayConcat__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0____ = r""" +arrayConcat(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[3,2,1,3,2,1] +""" + +Table___Decimal256_0____arrayConcat__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0____ = r""" +a +[3,2,1,3,2,1] +""" + +Inline___Decimal256_0____arrayFilter_x____x____1___ = r""" +arrayFilter(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[1] +""" + +Table___Decimal256_0____arrayFilter_x____x____1___ = r""" +a +[1] +""" + +Inline___Decimal256_0____arraySplit__x__y_____x_y___0__0__0___ = r""" +arraySplit(lambda(tuple(x, y), equals(x, y)), [0, 0, 0], array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +[[0,0,0]] +""" + +Table___Decimal256_0____arraySplit__x__y_____x_y___0__0__0___ = r""" +a +[[0,0,0]] +""" + +Inline___Decimal256_0____arrayZip__toDecimal256__1__0____ = r""" +arrayZip(array(toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0))) +[(1,3)] +""" + +Table___Decimal256_0____arrayZip__toDecimal256__1__0____ = r""" +a +[(1,1)] +""" + +Inline___Decimal256_0____empty__ = r""" +empty(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +0 +""" + +Table___Decimal256_0____empty__ = r""" +a +0 +""" + +Inline___Decimal256_0____notEmpty__ = r""" +notEmpty(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____notEmpty__ = r""" +a +1 +""" + +Inline___Decimal256_0____length__ = r""" +length(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____length__ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayCount_x____x____1___ = r""" +arrayCount(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____arrayCount_x____x____1___ = r""" +a +1 +""" + +Inline___Decimal256_0____arrayUniq__ = r""" +arrayUniq(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____arrayUniq__ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayJoin__ = r""" +arrayJoin(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +2 +1 +""" + +Table___Decimal256_0____arrayJoin__ = r""" +a +1 +2 +3 +""" + +Inline___Decimal256_0____arrayExists_x____x__1__ = r""" +arrayExists(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____arrayExists_x____x__1__ = r""" +a +1 +""" + +Inline___Decimal256_0____arrayAll_x____x__1__ = r""" +arrayAll(lambda(tuple(x), equals(x, 1)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +0 +""" + +Table___Decimal256_0____arrayAll_x____x__1__ = r""" +a +0 +""" + +Table___Decimal256_0____arrayMin__ = r""" +a +""" + +Table___Decimal256_0____arrayMax__ = r""" +a +""" + +Table___Decimal256_0____arraySum__ = r""" +a +""" + +Table___Decimal256_0____arrayAvg__ = r""" +a +""" + +Inline___Decimal256_0____arrayReduce__max____ = r""" +arrayReduce(\'max\', array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____arrayReduce__max____ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayFirst_x____x__3__ = r""" +arrayFirst(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +3 +""" + +Table___Decimal256_0____arrayFirst_x____x__3__ = r""" +a +3 +""" + +Inline___Decimal256_0____arrayFirstIndex_x____x__3__ = r""" +arrayFirstIndex(lambda(tuple(x), equals(x, 3)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____arrayFirstIndex_x____x__3__ = r""" +a +1 +""" + +Inline___Decimal256_0____hasAll__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0_____ = r""" +hasAll(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____hasAll__toDecimal256__3__0___toDecimal256__2__0___toDecimal256__1__0_____ = r""" +a +1 +""" + +Inline___Decimal256_0____hasAny__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +hasAny(array(toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +1 +""" + +Table___Decimal256_0____hasAny__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +a +1 +""" + +Inline___Decimal256_0____hasSubstr__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +hasSubstr(array(toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0))) +0 +""" + +Table___Decimal256_0____hasSubstr__toDecimal256__2__0___toDecimal256__1__0_____ = r""" +a +0 +""" + +Table___Decimal256_0____arrayDifference__ = r""" +a +""" + +Table___Decimal256_0____arrayCumSum__ = r""" +a +""" + +Table___Decimal256_0____arrayCumSumNonNegative__ = r""" +a +""" + +Inline___Decimal256_0____arrayElement = r""" +arrayElement(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), 1) +3 +""" + +Table___Decimal256_0____arrayElement = r""" +a +3 +""" + +Inline___Decimal256_0____arrayPushBack = r""" +arrayPushBack(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), toDecimal256(\'1\', 0)) +[3,2,1,1] +""" + +Table___Decimal256_0____arrayPushBack = r""" +a +[3,2,1,1] +""" + +Inline___Decimal256_0____arrayPushFront = r""" +arrayPushFront(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), toDecimal256(\'1\', 0)) +[1,3,2,1] +""" + +Table___Decimal256_0____arrayPushFront = r""" +a +[1,3,2,1] +""" + +Inline___Decimal256_0____arrayResize = r""" +arrayResize(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), 1) +[3] +""" + +Table___Decimal256_0____arrayResize = r""" +a +[3] +""" + +Inline___Decimal256_0____arraySlice = r""" +arraySlice(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), 1) +[3,2,1] +""" + +Table___Decimal256_0____arraySlice = r""" +a +[3,2,1] +""" + +Inline___Decimal256_0____has = r""" +has(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), NULL) +0 +""" + +Table___Decimal256_0____has = r""" +a +0 +""" + +Inline___Decimal256_0____indexOf = r""" +indexOf(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), NULL) +0 +""" + +Table___Decimal256_0____indexOf = r""" +a +0 +""" + +Inline___Decimal256_0____countEqual = r""" +countEqual(array(toDecimal256(\'3\', 0), toDecimal256(\'2\', 0), toDecimal256(\'1\', 0)), NULL) +0 +""" + +Table___Decimal256_0____countEqual = r""" +a +0 +""" + +Creating_a_tuple_with_Decimal256_0__on_a_table = r""" +a +(1,1,1) +""" + +tupleElement_with_Decimal256_0__on_a_table = r""" +a +1 +""" + +untuple_with_Decimal256_0__on_a_table = r""" +a +1 +""" + +tupleHammingDistance_with_Decimal256_0__on_a_table = r""" +a +2 +""" + +Creating_a_map_with_Decimal256_0__on_a_table = r""" +a +{'key1':1,'key2':2} +""" + +mapAdd_with_Decimal256_0__on_a_table = r""" +a +""" + +mapSubtract_with_Decimal256_0__on_a_table = r""" +a +""" + +mapPopulateSeries_with_Decimal256_0__on_a_table = r""" +a +""" + +mapContains_with_Decimal256_0__on_a_table = r""" +a +1 +""" + +mapKeys_with_Decimal256_0__on_a_table = r""" +a +['key1','key2'] +""" + +mapValues_with_Decimal256_0__on_a_table = r""" +a +[1,2] +""" + +I_check_equals_with_Int128 = r""" +equals(toInt128(1), toInt128(1)) equals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +1 0 +""" + +I_check_equals_with_Int256 = r""" +equals(toInt256(1), toInt256(1)) equals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 0 +""" + +I_check_equals_with_UInt128 = r""" +equals(toUInt128(1), toUInt128(1)) equals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +1 0 +""" + +I_check_equals_with_UInt256 = r""" +equals(toUInt256(1), toUInt256(1)) equals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +1 0 +""" + +I_check_notEquals_with_Int128 = r""" +notEquals(toInt128(1), toInt128(1)) notEquals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +0 1 +""" + +I_check_notEquals_with_Int256 = r""" +notEquals(toInt256(1), toInt256(1)) notEquals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +0 1 +""" + +I_check_notEquals_with_UInt128 = r""" +notEquals(toUInt128(1), toUInt128(1)) notEquals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +0 1 +""" + +I_check_notEquals_with_UInt256 = r""" +notEquals(toUInt256(1), toUInt256(1)) notEquals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +0 1 +""" + +I_check_less_with_Int128 = r""" +less(toInt128(1), toInt128(1)) less(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +0 0 +""" + +I_check_less_with_Int256 = r""" +less(toInt256(1), toInt256(1)) less(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +0 0 +""" + +I_check_less_with_UInt128 = r""" +less(toUInt128(1), toUInt128(1)) less(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +0 0 +""" + +I_check_less_with_UInt256 = r""" +less(toUInt256(1), toUInt256(1)) less(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +0 0 +""" + +I_check_greater_with_Int128 = r""" +greater(toInt128(1), toInt128(1)) greater(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +0 1 +""" + +I_check_greater_with_Int256 = r""" +greater(toInt256(1), toInt256(1)) greater(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +0 1 +""" + +I_check_greater_with_UInt128 = r""" +greater(toUInt128(1), toUInt128(1)) greater(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +0 1 +""" + +I_check_greater_with_UInt256 = r""" +greater(toUInt256(1), toUInt256(1)) greater(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +0 1 +""" + +I_check_lessOrEquals_with_Int128 = r""" +lessOrEquals(toInt128(1), toInt128(1)) lessOrEquals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +1 0 +""" + +I_check_lessOrEquals_with_Int256 = r""" +lessOrEquals(toInt256(1), toInt256(1)) lessOrEquals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 0 +""" + +I_check_lessOrEquals_with_UInt128 = r""" +lessOrEquals(toUInt128(1), toUInt128(1)) lessOrEquals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +1 0 +""" + +I_check_lessOrEquals_with_UInt256 = r""" +lessOrEquals(toUInt256(1), toUInt256(1)) lessOrEquals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +1 0 +""" + +I_check_greaterOrEquals_with_Int128 = r""" +greaterOrEquals(toInt128(1), toInt128(1)) greaterOrEquals(toInt128(\'170141183460469231731687303715884105727\'), toInt128(\'-170141183460469231731687303715884105728\')) +1 1 +""" + +I_check_greaterOrEquals_with_Int256 = r""" +greaterOrEquals(toInt256(1), toInt256(1)) greaterOrEquals(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 1 +""" + +I_check_greaterOrEquals_with_UInt128 = r""" +greaterOrEquals(toUInt128(1), toUInt128(1)) greaterOrEquals(toUInt128(\'340282366920938463463374607431768211455\'), toUInt128(\'0\')) +1 1 +""" + +I_check_greaterOrEquals_with_UInt256 = r""" +greaterOrEquals(toUInt256(1), toUInt256(1)) greaterOrEquals(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), toUInt256(\'0\')) +1 1 +""" + +I_check_the_table_for_the_output_of_equals_with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_equals_with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_equals_with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_equals_with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_less_with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_less_with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_less_with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_less_with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_equals_with_Decimal256 = r""" +equals(toDecimal256(1, 0), toDecimal256(1, 0)) equals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 0 +""" + +I_check_notEquals_with_Decimal256 = r""" +notEquals(toDecimal256(1, 0), toDecimal256(1, 0)) notEquals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 1 +""" + +I_check_less_with_Decimal256 = r""" +less(toDecimal256(1, 0), toDecimal256(1, 0)) less(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 0 +""" + +I_check_greater_with_Decimal256 = r""" +greater(toDecimal256(1, 0), toDecimal256(1, 0)) greater(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 1 +""" + +I_check_lessOrEquals_with_Decimal256 = r""" +lessOrEquals(toDecimal256(1, 0), toDecimal256(1, 0)) lessOrEquals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 0 +""" + +I_check_greaterOrEquals_with_Decimal256 = r""" +greaterOrEquals(toDecimal256(1, 0), toDecimal256(1, 0)) greaterOrEquals(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0), toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_the_table_for_the_output_of_equals_with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_notEquals_with_Decimal256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_less_with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_greater_with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_table_for_the_output_of_lessOrEquals_with_Decimal256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_for_the_output_of_greaterOrEquals_with_Decimal256 = r""" +a +0 +1 +1 +""" + +I_check_exp__with_Int128_using_max_and_min = r""" +round(exp(toInt128(\'170141183460469231731687303715884105727\')), 7) round(exp(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf 0 +""" + +I_check_exp__with_Int256_using_max_and_min = r""" +round(exp(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(exp(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf 0 +""" + +I_check_exp__with_UInt128_using_max_and_min = r""" +round(exp(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(exp(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_exp__with_UInt256_using_max_and_min = r""" +round(exp(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(exp(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_log__with_Int128_using_max_and_min = r""" +round(log(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.0296919 nan +""" + +I_check_log__with_Int256_using_max_and_min = r""" +round(log(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +176.752531 nan +""" + +I_check_log__with_UInt128_using_max_and_min = r""" +round(log(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log(toUInt128(\'0\')), 7) +88.7228391 -inf +""" + +I_check_log__with_UInt256_using_max_and_min = r""" +round(log(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log(toUInt256(\'0\')), 7) +177.4456782 -inf +""" + +I_check_ln__with_Int128_using_max_and_min = r""" +round(log(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.0296919 nan +""" + +I_check_ln__with_Int256_using_max_and_min = r""" +round(log(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +176.752531 nan +""" + +I_check_ln__with_UInt128_using_max_and_min = r""" +round(log(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log(toUInt128(\'0\')), 7) +88.7228391 -inf +""" + +I_check_ln__with_UInt256_using_max_and_min = r""" +round(log(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log(toUInt256(\'0\')), 7) +177.4456782 -inf +""" + +I_check_exp2__with_Int128_using_max_and_min = r""" +round(exp2(toInt128(\'170141183460469231731687303715884105727\')), 7) round(exp2(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf 0 +""" + +I_check_exp2__with_Int256_using_max_and_min = r""" +round(exp2(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(exp2(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf 0 +""" + +I_check_exp2__with_UInt128_using_max_and_min = r""" +round(exp2(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(exp2(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_exp2__with_UInt256_using_max_and_min = r""" +round(exp2(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(exp2(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_log2__with_Int128_using_max_and_min = r""" +round(log2(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log2(toInt128(\'-170141183460469231731687303715884105728\')), 7) +127 nan +""" + +I_check_log2__with_Int256_using_max_and_min = r""" +round(log2(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log2(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +255 nan +""" + +I_check_log2__with_UInt128_using_max_and_min = r""" +round(log2(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log2(toUInt128(\'0\')), 7) +128 -inf +""" + +I_check_log2__with_UInt256_using_max_and_min = r""" +round(log2(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log2(toUInt256(\'0\')), 7) +256 -inf +""" + +I_check_exp10__with_Int128_using_max_and_min = r""" +round(exp10(toInt128(\'170141183460469231731687303715884105727\')), 7) round(exp10(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf 0 +""" + +I_check_exp10__with_Int256_using_max_and_min = r""" +round(exp10(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(exp10(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf 0 +""" + +I_check_exp10__with_UInt128_using_max_and_min = r""" +round(exp10(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(exp10(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_exp10__with_UInt256_using_max_and_min = r""" +round(exp10(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(exp10(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_log10__with_Int128_using_max_and_min = r""" +round(log10(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log10(toInt128(\'-170141183460469231731687303715884105728\')), 7) +38.2308094 nan +""" + +I_check_log10__with_Int256_using_max_and_min = r""" +round(log10(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log10(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +76.7626489 nan +""" + +I_check_log10__with_UInt128_using_max_and_min = r""" +round(log10(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log10(toUInt128(\'0\')), 7) +38.5318394 -inf +""" + +I_check_log10__with_UInt256_using_max_and_min = r""" +round(log10(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log10(toUInt256(\'0\')), 7) +77.0636789 -inf +""" + +I_check_sqrt__with_Int128_using_max_and_min = r""" +round(sqrt(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sqrt(toInt128(\'-170141183460469231731687303715884105728\')), 7) +13043817825332783000 nan +""" + +I_check_sqrt__with_Int256_using_max_and_min = r""" +round(sqrt(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sqrt(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +2.4061596916800453e38 nan +""" + +I_check_sqrt__with_UInt128_using_max_and_min = r""" +round(sqrt(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sqrt(toUInt128(\'0\')), 7) +18446744073709552000 0 +""" + +I_check_sqrt__with_UInt256_using_max_and_min = r""" +round(sqrt(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sqrt(toUInt256(\'0\')), 7) +3.402823669209385e38 0 +""" + +I_check_cbrt__with_Int128_using_max_and_min = r""" +round(cbrt(toInt128(\'170141183460469231731687303715884105727\')), 7) round(cbrt(toInt128(\'-170141183460469231731687303715884105728\')), 7) +5541191377756.637 -5541191377756.637 +""" + +I_check_cbrt__with_Int256_using_max_and_min = r""" +round(cbrt(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(cbrt(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +3.8685626227668134e25 -3.8685626227668134e25 +""" + +I_check_cbrt__with_UInt128_using_max_and_min = r""" +round(cbrt(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(cbrt(toUInt128(\'0\')), 7) +6981463658331.56 0 +""" + +I_check_cbrt__with_UInt256_using_max_and_min = r""" +round(cbrt(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(cbrt(toUInt256(\'0\')), 7) +4.874083481260429e25 0 +""" + +I_check_erf__with_Int128_using_max_and_min = r""" +round(erf(toInt128(\'170141183460469231731687303715884105727\')), 7) round(erf(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1 -1 +""" + +I_check_erf__with_Int256_using_max_and_min = r""" +round(erf(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(erf(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1 -1 +""" + +I_check_erf__with_UInt128_using_max_and_min = r""" +round(erf(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(erf(toUInt128(\'0\')), 7) +1 0 +""" + +I_check_erf__with_UInt256_using_max_and_min = r""" +round(erf(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(erf(toUInt256(\'0\')), 7) +1 0 +""" + +I_check_erfc__with_Int128_using_max_and_min = r""" +round(erfc(toInt128(\'170141183460469231731687303715884105727\')), 7) round(erfc(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0 2 +""" + +I_check_erfc__with_Int256_using_max_and_min = r""" +round(erfc(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(erfc(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +0 2 +""" + +I_check_erfc__with_UInt128_using_max_and_min = r""" +round(erfc(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(erfc(toUInt128(\'0\')), 7) +0 1 +""" + +I_check_erfc__with_UInt256_using_max_and_min = r""" +round(erfc(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(erfc(toUInt256(\'0\')), 7) +0 1 +""" + +I_check_lgamma__with_Int128_using_max_and_min = r""" +round(lgamma(toInt128(\'170141183460469231731687303715884105727\')), 7) round(lgamma(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1.4807334781359624e40 -1.4807334781359624e40 +""" + +I_check_lgamma__with_Int256_using_max_and_min = r""" +round(lgamma(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(lgamma(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1.0175376379095233e79 -1.0175376379095233e79 +""" + +I_check_lgamma__with_UInt128_using_max_and_min = r""" +round(lgamma(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(lgamma(toUInt128(\'0\')), 7) +2.985053532594476e40 inf +""" + +I_check_lgamma__with_UInt256_using_max_and_min = r""" +round(lgamma(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(lgamma(toUInt256(\'0\')), 7) +2.0431013718376458e79 inf +""" + +I_check_tgamma__with_Int128_using_max_and_min = r""" +round(tgamma(toInt128(\'170141183460469231731687303715884105727\')), 7) round(tgamma(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf nan +""" + +I_check_tgamma__with_Int256_using_max_and_min = r""" +round(tgamma(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(tgamma(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf nan +""" + +I_check_tgamma__with_UInt128_using_max_and_min = r""" +round(tgamma(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(tgamma(toUInt128(\'0\')), 7) +inf inf +""" + +I_check_tgamma__with_UInt256_using_max_and_min = r""" +round(tgamma(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(tgamma(toUInt256(\'0\')), 7) +inf inf +""" + +I_check_sin__with_Int128_using_max_and_min = r""" +round(sin(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sin(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0.6233855 -0.6233855 +""" + +I_check_sin__with_Int256_using_max_and_min = r""" +round(sin(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sin(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +0.9751222 -0.9751222 +""" + +I_check_sin__with_UInt128_using_max_and_min = r""" +round(sin(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sin(toUInt128(\'0\')), 7) +0.9748685 0 +""" + +I_check_sin__with_UInt256_using_max_and_min = r""" +round(sin(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sin(toUInt256(\'0\')), 7) +0.4323066 0 +""" + +I_check_cos__with_Int128_using_max_and_min = r""" +round(cos(toInt128(\'170141183460469231731687303715884105727\')), 7) round(cos(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0.7819146 0.7819146 +""" + +I_check_cos__with_Int256_using_max_and_min = r""" +round(cos(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(cos(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +0.2216679 0.2216679 +""" + +I_check_cos__with_UInt128_using_max_and_min = r""" +round(cos(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(cos(toUInt128(\'0\')), 7) +0.222781 1 +""" + +I_check_cos__with_UInt256_using_max_and_min = r""" +round(cos(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(cos(toUInt256(\'0\')), 7) +-0.9017267 1 +""" + +I_check_tan__with_Int128_using_max_and_min = r""" +round(tan(toInt128(\'170141183460469231731687303715884105727\')), 7) round(tan(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0.7972552 -0.7972552 +""" + +I_check_tan__with_Int256_using_max_and_min = r""" +round(tan(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(tan(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +4.3990229 -4.3990229 +""" + +I_check_tan__with_UInt128_using_max_and_min = r""" +round(tan(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(tan(toUInt128(\'0\')), 7) +4.375905 0 +""" + +I_check_tan__with_UInt256_using_max_and_min = r""" +round(tan(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(tan(toUInt256(\'0\')), 7) +-0.4794209 0 +""" + +I_check_asin__with_Int128_using_max_and_min = r""" +round(asin(toInt128(\'170141183460469231731687303715884105727\')), 7) round(asin(toInt128(\'-170141183460469231731687303715884105728\')), 7) +nan nan +""" + +I_check_asin__with_Int256_using_max_and_min = r""" +round(asin(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(asin(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +nan nan +""" + +I_check_asin__with_UInt128_using_max_and_min = r""" +round(asin(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(asin(toUInt128(\'0\')), 7) +nan 0 +""" + +I_check_asin__with_UInt256_using_max_and_min = r""" +round(asin(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(asin(toUInt256(\'0\')), 7) +nan 0 +""" + +I_check_acos__with_Int128_using_max_and_min = r""" +round(acos(toInt128(\'170141183460469231731687303715884105727\')), 7) round(acos(toInt128(\'-170141183460469231731687303715884105728\')), 7) +nan nan +""" + +I_check_acos__with_Int256_using_max_and_min = r""" +round(acos(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(acos(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +nan nan +""" + +I_check_acos__with_UInt128_using_max_and_min = r""" +round(acos(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(acos(toUInt128(\'0\')), 7) +nan 1.5707963 +""" + +I_check_acos__with_UInt256_using_max_and_min = r""" +round(acos(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(acos(toUInt256(\'0\')), 7) +nan 1.5707963 +""" + +I_check_atan__with_Int128_using_max_and_min = r""" +round(atan(toInt128(\'170141183460469231731687303715884105727\')), 7) round(atan(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1.5707963 -1.5707963 +""" + +I_check_atan__with_Int256_using_max_and_min = r""" +round(atan(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(atan(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1.5707963 -1.5707963 +""" + +I_check_atan__with_UInt128_using_max_and_min = r""" +round(atan(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(atan(toUInt128(\'0\')), 7) +1.5707963 0 +""" + +I_check_atan__with_UInt256_using_max_and_min = r""" +round(atan(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(atan(toUInt256(\'0\')), 7) +1.5707963 0 +""" + +I_check_cosh__with_Int128_using_max_and_min = r""" +round(cosh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(cosh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf inf +""" + +I_check_cosh__with_Int256_using_max_and_min = r""" +round(cosh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(cosh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf inf +""" + +I_check_cosh__with_UInt128_using_max_and_min = r""" +round(cosh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(cosh(toUInt128(\'0\')), 7) +inf 1 +""" + +I_check_cosh__with_UInt256_using_max_and_min = r""" +round(cosh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(cosh(toUInt256(\'0\')), 7) +inf 1 +""" + +I_check_acosh__with_Int128_using_max_and_min = r""" +round(acosh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(acosh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.7228391 nan +""" + +I_check_acosh__with_Int256_using_max_and_min = r""" +round(acosh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(acosh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +177.4456782 nan +""" + +I_check_acosh__with_UInt128_using_max_and_min = r""" +round(acosh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(acosh(toUInt128(\'0\')), 7) +89.4159863 nan +""" + +I_check_acosh__with_UInt256_using_max_and_min = r""" +round(acosh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(acosh(toUInt256(\'0\')), 7) +178.1388254 nan +""" + +I_check_sinh__with_Int128_using_max_and_min = r""" +round(sinh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sinh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +inf -inf +""" + +I_check_sinh__with_Int256_using_max_and_min = r""" +round(sinh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sinh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +inf -inf +""" + +I_check_sinh__with_UInt128_using_max_and_min = r""" +round(sinh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sinh(toUInt128(\'0\')), 7) +inf 0 +""" + +I_check_sinh__with_UInt256_using_max_and_min = r""" +round(sinh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sinh(toUInt256(\'0\')), 7) +inf 0 +""" + +I_check_asinh__with_Int128_using_max_and_min = r""" +round(asinh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(asinh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.7228391 -88.7228391 +""" + +I_check_asinh__with_Int256_using_max_and_min = r""" +round(asinh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(asinh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +177.4456782 -177.4456782 +""" + +I_check_asinh__with_UInt128_using_max_and_min = r""" +round(asinh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(asinh(toUInt128(\'0\')), 7) +89.4159863 0 +""" + +I_check_asinh__with_UInt256_using_max_and_min = r""" +round(asinh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(asinh(toUInt256(\'0\')), 7) +178.1388254 0 +""" + +I_check_tanh__with_Int128_using_max_and_min = r""" +round(tanh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(tanh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +1 -1 +""" + +I_check_tanh__with_Int256_using_max_and_min = r""" +round(tanh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(tanh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +1 -1 +""" + +I_check_tanh__with_UInt128_using_max_and_min = r""" +round(tanh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(tanh(toUInt128(\'0\')), 7) +1 0 +""" + +I_check_tanh__with_UInt256_using_max_and_min = r""" +round(tanh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(tanh(toUInt256(\'0\')), 7) +1 0 +""" + +I_check_atanh__with_Int128_using_max_and_min = r""" +round(atanh(toInt128(\'170141183460469231731687303715884105727\')), 7) round(atanh(toInt128(\'-170141183460469231731687303715884105728\')), 7) +nan nan +""" + +I_check_atanh__with_Int256_using_max_and_min = r""" +round(atanh(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(atanh(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +nan nan +""" + +I_check_atanh__with_UInt128_using_max_and_min = r""" +round(atanh(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(atanh(toUInt128(\'0\')), 7) +nan 0 +""" + +I_check_atanh__with_UInt256_using_max_and_min = r""" +round(atanh(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(atanh(toUInt256(\'0\')), 7) +nan 0 +""" + +I_check_log1p__with_Int128_using_max_and_min = r""" +round(log1p(toInt128(\'170141183460469231731687303715884105727\')), 7) round(log1p(toInt128(\'-170141183460469231731687303715884105728\')), 7) +88.0296919 nan +""" + +I_check_log1p__with_Int256_using_max_and_min = r""" +round(log1p(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(log1p(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +176.752531 nan +""" + +I_check_log1p__with_UInt128_using_max_and_min = r""" +round(log1p(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(log1p(toUInt128(\'0\')), 7) +88.7228391 0 +""" + +I_check_log1p__with_UInt256_using_max_and_min = r""" +round(log1p(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(log1p(toUInt256(\'0\')), 7) +177.4456782 0 +""" + +I_check_sign__with_Int128_using_max_and_min = r""" +round(sign(toInt128(\'170141183460469231731687303715884105727\')), 7) round(sign(toInt128(\'-170141183460469231731687303715884105728\')), 7) +0 0 +""" + +I_check_sign__with_Int256_using_max_and_min = r""" +round(sign(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')), 7) round(sign(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')), 7) +0 0 +""" + +I_check_sign__with_UInt128_using_max_and_min = r""" +round(sign(toUInt128(\'340282366920938463463374607431768211455\')), 7) round(sign(toUInt128(\'0\')), 7) +0 0 +""" + +I_check_sign__with_UInt256_using_max_and_min = r""" +round(sign(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')), 7) round(sign(toUInt256(\'0\')), 7) +0 0 +""" + +I_check_the_outputs_of_exp__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_exp__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_log__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp2__with_Int128 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_exp2__with_Int256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_exp2__with_UInt128 = r""" +a +0 +1 +2 +""" + +I_check_the_outputs_of_exp2__with_UInt256 = r""" +a +0 +1 +2 +""" + +I_check_the_outputs_of_log2__with_Int128 = r""" +a +0 +0 +127 +""" + +I_check_the_outputs_of_log2__with_Int256 = r""" +a +0 +0 +255 +""" + +I_check_the_outputs_of_log2__with_UInt128 = r""" +a +0 +0 +128 +""" + +I_check_the_outputs_of_log2__with_UInt256 = r""" +a +0 +0 +256 +""" + +I_check_the_outputs_of_exp10__with_Int128 = r""" +a +0 +0 +10 +""" + +I_check_the_outputs_of_exp10__with_Int256 = r""" +a +0 +0 +10 +""" + +I_check_the_outputs_of_exp10__with_UInt128 = r""" +a +0 +1 +10 +""" + +I_check_the_outputs_of_exp10__with_UInt256 = r""" +a +0 +1 +10 +""" + +I_check_the_outputs_of_log10__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log10__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log10__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log10__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sqrt__with_Int128 = r""" +a +0 +1 +13043817825332783000 +""" + +I_check_the_outputs_of_sqrt__with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_sqrt__with_UInt128 = r""" +a +0 +1 +18446744073709552000 +""" + +I_check_the_outputs_of_sqrt__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cbrt__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erf__with_Int128 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_erf__with_Int256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_erf__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erf__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erfc__with_Int128 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_erfc__with_Int256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_erfc__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_erfc__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_lgamma__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_lgamma__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_lgamma__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_lgamma__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tgamma__with_Int128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tgamma__with_Int256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tgamma__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tgamma__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_sin__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sin__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sin__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sin__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cos__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tan__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_cosh__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_acosh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tanh__with_Int128 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_tanh__with_Int256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_tanh__with_UInt128 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_tanh__with_UInt256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_atanh__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atanh__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atanh__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atanh__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_Int128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_Int256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_UInt128 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_UInt256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sign__with_Int128 = r""" +a +-1 +1 +1 +""" + +I_check_the_outputs_of_sign__with_Int256 = r""" +a +-1 +1 +1 +""" + +I_check_the_outputs_of_sign__with_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_outputs_of_sign__with_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_exp__with_Decimal256_using_max_and_min = r""" +round(exp(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(exp(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf 0 +""" + +I_check_log__with_Decimal256_using_max_and_min = r""" +round(log(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +172.693882 nan +""" + +I_check_ln__with_Decimal256_using_max_and_min = r""" +round(log(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +172.693882 nan +""" + +I_check_exp2__with_Decimal256_using_max_and_min = r""" +round(exp2(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(exp2(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf 0 +""" + +I_check_log2__with_Decimal256_using_max_and_min = r""" +round(log2(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log2(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +249.1446071 nan +""" + +I_check_exp10__with_Decimal256_using_max_and_min = r""" +round(exp10(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(exp10(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf 0 +""" + +I_check_log10__with_Decimal256_using_max_and_min = r""" +round(log10(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log10(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +75 nan +""" + +I_check_sqrt__with_Decimal256_using_max_and_min = r""" +round(sqrt(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sqrt(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +3.1622776601683794e37 nan +""" + +I_check_cbrt__with_Decimal256_using_max_and_min = r""" +round(cbrt(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(cbrt(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1e25 -1e25 +""" + +I_check_erf__with_Decimal256_using_max_and_min = r""" +round(erf(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(erf(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1 -1 +""" + +I_check_erfc__with_Decimal256_using_max_and_min = r""" +round(erfc(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(erfc(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +0 2 +""" + +I_check_lgamma__with_Decimal256_using_max_and_min = r""" +round(lgamma(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(lgamma(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1.7169388197455342e77 -1.7169388197455342e77 +""" + +I_check_tgamma__with_Decimal256_using_max_and_min = r""" +round(tgamma(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(tgamma(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf nan +""" + +I_check_sin__with_Decimal256_using_max_and_min = r""" +round(sin(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sin(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +0.6633998 -0.6633998 +""" + +I_check_cos__with_Decimal256_using_max_and_min = r""" +round(cos(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(cos(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +-0.7482652 -0.7482652 +""" + +I_check_tan__with_Decimal256_using_max_and_min = r""" +round(tan(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(tan(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +-0.8865838 0.8865838 +""" + +I_check_asin__with_Decimal256_using_max_and_min = r""" +round(asin(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(asin(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +nan nan +""" + +I_check_acos__with_Decimal256_using_max_and_min = r""" +round(acos(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(acos(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +nan nan +""" + +I_check_atan__with_Decimal256_using_max_and_min = r""" +round(atan(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(atan(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1.5707963 -1.5707963 +""" + +I_check_cosh__with_Decimal256_using_max_and_min = r""" +round(cosh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(cosh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf inf +""" + +I_check_acosh__with_Decimal256_using_max_and_min = r""" +round(acosh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(acosh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +173.3870292 nan +""" + +I_check_sinh__with_Decimal256_using_max_and_min = r""" +round(sinh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sinh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +inf -inf +""" + +I_check_asinh__with_Decimal256_using_max_and_min = r""" +round(asinh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(asinh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +173.3870292 -173.3870292 +""" + +I_check_tanh__with_Decimal256_using_max_and_min = r""" +round(tanh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(tanh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +1 -1 +""" + +I_check_atanh__with_Decimal256_using_max_and_min = r""" +round(atanh(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(atanh(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +nan nan +""" + +I_check_log1p__with_Decimal256_using_max_and_min = r""" +round(log1p(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(log1p(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +172.693882 nan +""" + +I_check_sign__with_Decimal256_using_max_and_min = r""" +round(sign(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) round(sign(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)), 7) +0 0 +""" + +I_check_the_outputs_of_exp__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_ln__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp2__with_Decimal256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_log2__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_exp10__with_Decimal256 = r""" +a +0 +0 +10 +""" + +I_check_the_outputs_of_log10__with_Decimal256 = r""" +a +0 +0 +75 +""" + +I_check_the_outputs_of_sqrt__with_Decimal256 = r""" +a +0 +1 +31622776601683794000000000000000000000 +""" + +I_check_the_outputs_of_cbrt__with_Decimal256 = r""" +a +-10000000000000000000000000 +1 +10000000000000000000000000 +""" + +I_check_the_outputs_of_erf__with_Decimal256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_erfc__with_Decimal256 = r""" +a +0 +0 +2 +""" + +I_check_the_outputs_of_lgamma__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tgamma__with_Decimal256 = r""" +a +0 +0 +1 +""" + +I_check_the_outputs_of_sin__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cos__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tan__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asin__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acos__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_atan__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_cosh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_acosh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sinh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_asinh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_tanh__with_Decimal256 = r""" +a +-1 +0 +1 +""" + +I_check_the_outputs_of_atanh__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_log1p__with_Decimal256 = r""" +a +0 +0 +0 +""" + +I_check_the_outputs_of_sign__with_Decimal256 = r""" +a +-1 +1 +1 +""" + +I_check_ceil_with_Int128_using_min_and_max_values = r""" +ceil(toInt128(\'-170141183460469231731687303715884105728\')) ceil(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_ceil_with_Int256_using_min_and_max_values = r""" +ceil(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) ceil(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_ceil_with_UInt128_using_min_and_max_values = r""" +ceil(toUInt128(\'0\')) ceil(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_ceil_with_UInt256_using_min_and_max_values = r""" +ceil(toUInt256(\'0\')) ceil(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_floor_with_Int128_using_min_and_max_values = r""" +floor(toInt128(\'-170141183460469231731687303715884105728\')) floor(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_floor_with_Int256_using_min_and_max_values = r""" +floor(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) floor(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_floor_with_UInt128_using_min_and_max_values = r""" +floor(toUInt128(\'0\')) floor(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_floor_with_UInt256_using_min_and_max_values = r""" +floor(toUInt256(\'0\')) floor(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_trunc_with_Int128_using_min_and_max_values = r""" +trunc(toInt128(\'-170141183460469231731687303715884105728\')) trunc(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_trunc_with_Int256_using_min_and_max_values = r""" +trunc(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) trunc(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_trunc_with_UInt128_using_min_and_max_values = r""" +trunc(toUInt128(\'0\')) trunc(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_trunc_with_UInt256_using_min_and_max_values = r""" +trunc(toUInt256(\'0\')) trunc(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_round_with_Int128_using_min_and_max_values = r""" +round(toInt128(\'-170141183460469231731687303715884105728\')) round(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_round_with_Int256_using_min_and_max_values = r""" +round(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) round(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_round_with_UInt128_using_min_and_max_values = r""" +round(toUInt128(\'0\')) round(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_round_with_UInt256_using_min_and_max_values = r""" +round(toUInt256(\'0\')) round(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_roundBankers_with_Int128_using_min_and_max_values = r""" +roundBankers(toInt128(\'-170141183460469231731687303715884105728\')) roundBankers(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_roundBankers_with_Int256_using_min_and_max_values = r""" +roundBankers(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) roundBankers(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_roundBankers_with_UInt128_using_min_and_max_values = r""" +roundBankers(toUInt128(\'0\')) roundBankers(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_roundBankers_with_UInt256_using_min_and_max_values = r""" +roundBankers(toUInt256(\'0\')) roundBankers(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_roundDuration_with_Int128_using_min_and_max_values = r""" +roundDuration(toInt128(\'-170141183460469231731687303715884105728\')) roundDuration(toInt128(\'170141183460469231731687303715884105727\')) +0 36000 +""" + +I_check_roundDuration_with_Int256_using_min_and_max_values = r""" +roundDuration(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) roundDuration(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +0 36000 +""" + +I_check_roundDuration_with_UInt128_using_min_and_max_values = r""" +roundDuration(toUInt128(\'0\')) roundDuration(toUInt128(\'340282366920938463463374607431768211455\')) +0 36000 +""" + +I_check_roundDuration_with_UInt256_using_min_and_max_values = r""" +roundDuration(toUInt256(\'0\')) roundDuration(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 36000 +""" + +I_check_roundAge_with_Int128_using_min_and_max_values = r""" +roundAge(toInt128(\'-170141183460469231731687303715884105728\')) roundAge(toInt128(\'170141183460469231731687303715884105727\')) +0 55 +""" + +I_check_roundAge_with_Int256_using_min_and_max_values = r""" +roundAge(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) roundAge(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +0 55 +""" + +I_check_roundAge_with_UInt128_using_min_and_max_values = r""" +roundAge(toUInt128(\'0\')) roundAge(toUInt128(\'340282366920938463463374607431768211455\')) +0 55 +""" + +I_check_roundAge_with_UInt256_using_min_and_max_values = r""" +roundAge(toUInt256(\'0\')) roundAge(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 55 +""" + +I_select_the_output_of_ceil_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_ceil_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_ceil_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_ceil_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_floor_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_floor_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_floor_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_floor_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_trunc_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_trunc_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_trunc_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_trunc_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_round_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_round_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_round_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_round_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_roundBankers_with_Int128_from_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_select_the_output_of_roundBankers_with_Int256_from_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_select_the_output_of_roundBankers_with_UInt128_from_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_select_the_output_of_roundBankers_with_UInt256_from_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_select_the_output_of_roundDuration_with_Int128_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundDuration_with_Int256_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundDuration_with_UInt128_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundDuration_with_UInt256_from_the_table = r""" +a +0 +1 +36000 +""" + +I_select_the_output_of_roundAge_with_Int128_from_the_table = r""" +a +0 +17 +55 +""" + +I_select_the_output_of_roundAge_with_Int256_from_the_table = r""" +a +0 +17 +55 +""" + +I_select_the_output_of_roundAge_with_UInt128_from_the_table = r""" +a +0 +17 +55 +""" + +I_select_the_output_of_roundAge_with_UInt256_from_the_table = r""" +a +0 +17 +55 +""" + +I_check_ceil_with_Decimal256_using_min_and_max_values = r""" +ceil(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) ceil(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_floor_with_Decimal256_using_min_and_max_values = r""" +floor(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) floor(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_trunc_with_Decimal256_using_min_and_max_values = r""" +trunc(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) trunc(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_round_with_Decimal256_using_min_and_max_values = r""" +round(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) round(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_roundBankers_with_Decimal256_using_min_and_max_values = r""" +roundBankers(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) roundBankers(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_ceil_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_floor_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_trunc_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_round_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_select_the_output_of_roundBankers_with_Decimal256_from_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_bitAnd_with_Int128 = r""" +bitAnd(toInt128(1), 1) bitAnd(toInt128(\'170141183460469231731687303715884105727\'), 1) bitAnd(toInt128(\'-170141183460469231731687303715884105728\'), 1) +1 1 0 +""" + +I_check_bitAnd_with_Int256 = r""" +bitAnd(toInt256(1), 1) bitAnd(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitAnd(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +1 1 0 +""" + +I_check_bitAnd_with_UInt128 = r""" +bitAnd(toUInt128(1), 1) bitAnd(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitAnd(toUInt128(\'0\'), 1) +1 1 0 +""" + +I_check_bitAnd_with_UInt256 = r""" +bitAnd(toUInt256(1), 1) bitAnd(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitAnd(toUInt256(\'0\'), 1) +1 1 0 +""" + +I_check_bitOr_with_Int128 = r""" +bitOr(toInt128(1), 1) bitOr(toInt128(\'170141183460469231731687303715884105727\'), 1) bitOr(toInt128(\'-170141183460469231731687303715884105728\'), 1) +1 170141183460469231731687303715884105727 -170141183460469231731687303715884105727 +""" + +I_check_bitOr_with_Int256 = r""" +bitOr(toInt256(1), 1) bitOr(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitOr(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +1 57896044618658097711785492504343953926634992332820282019728792003956564819967 -57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_bitOr_with_UInt128 = r""" +bitOr(toUInt128(1), 1) bitOr(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitOr(toUInt128(\'0\'), 1) +1 340282366920938463463374607431768211455 1 +""" + +I_check_bitOr_with_UInt256 = r""" +bitOr(toUInt256(1), 1) bitOr(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitOr(toUInt256(\'0\'), 1) +1 115792089237316195423570985008687907853269984665640564039457584007913129639935 1 +""" + +I_check_bitXor_with_Int128 = r""" +bitXor(toInt128(1), 1) bitXor(toInt128(\'170141183460469231731687303715884105727\'), 1) bitXor(toInt128(\'-170141183460469231731687303715884105728\'), 1) +0 170141183460469231731687303715884105726 -170141183460469231731687303715884105727 +""" + +I_check_bitXor_with_Int256 = r""" +bitXor(toInt256(1), 1) bitXor(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitXor(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +0 57896044618658097711785492504343953926634992332820282019728792003956564819966 -57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_bitXor_with_UInt128 = r""" +bitXor(toUInt128(1), 1) bitXor(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitXor(toUInt128(\'0\'), 1) +0 340282366920938463463374607431768211454 1 +""" + +I_check_bitXor_with_UInt256 = r""" +bitXor(toUInt256(1), 1) bitXor(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitXor(toUInt256(\'0\'), 1) +0 115792089237316195423570985008687907853269984665640564039457584007913129639934 1 +""" + +I_check_bitShiftLeft_with_Int128 = r""" +bitShiftLeft(toInt128(1), 1) bitShiftLeft(toInt128(\'170141183460469231731687303715884105727\'), 1) bitShiftLeft(toInt128(\'-170141183460469231731687303715884105728\'), 1) +2 -2 0 +""" + +I_check_bitShiftLeft_with_Int256 = r""" +bitShiftLeft(toInt256(1), 1) bitShiftLeft(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitShiftLeft(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +2 -2 0 +""" + +I_check_bitShiftLeft_with_UInt128 = r""" +bitShiftLeft(toUInt128(1), 1) bitShiftLeft(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitShiftLeft(toUInt128(\'0\'), 1) +2 340282366920938463463374607431768211454 0 +""" + +I_check_bitShiftLeft_with_UInt256 = r""" +bitShiftLeft(toUInt256(1), 1) bitShiftLeft(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitShiftLeft(toUInt256(\'0\'), 1) +2 115792089237316195423570985008687907853269984665640564039457584007913129639934 0 +""" + +I_check_bitShiftRight_with_Int128 = r""" +bitShiftRight(toInt128(1), 1) bitShiftRight(toInt128(\'170141183460469231731687303715884105727\'), 1) bitShiftRight(toInt128(\'-170141183460469231731687303715884105728\'), 1) +0 85070591730234615865843651857942052863 -85070591730234615865843651857942052864 +""" + +I_check_bitShiftRight_with_Int256 = r""" +bitShiftRight(toInt256(1), 1) bitShiftRight(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\'), 1) bitShiftRight(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\'), 1) +0 28948022309329048855892746252171976963317496166410141009864396001978282409983 -28948022309329048855892746252171976963317496166410141009864396001978282409984 +""" + +I_check_bitShiftRight_with_UInt128 = r""" +bitShiftRight(toUInt128(1), 1) bitShiftRight(toUInt128(\'340282366920938463463374607431768211455\'), 1) bitShiftRight(toUInt128(\'0\'), 1) +0 170141183460469231731687303715884105727 0 +""" + +I_check_bitShiftRight_with_UInt256 = r""" +bitShiftRight(toUInt256(1), 1) bitShiftRight(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\'), 1) bitShiftRight(toUInt256(\'0\'), 1) +0 57896044618658097711785492504343953926634992332820282019728792003956564819967 0 +""" + +Check_bitNot_with_Int128 = r""" +bitNot(toInt128(1)) bitNot(toInt128(\'170141183460469231731687303715884105727\')) bitNot(toInt128(\'-170141183460469231731687303715884105728\')) +-2 -170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +Check_bitNot_with_Int256 = r""" +bitNot(toInt256(1)) bitNot(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) bitNot(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +-2 -57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +Check_bitNot_with_UInt128 = r""" +bitNot(toUInt128(1)) bitNot(toUInt128(\'340282366920938463463374607431768211455\')) bitNot(toUInt128(\'0\')) +340282366920938463463374607431768211454 0 340282366920938463463374607431768211455 +""" + +Check_bitNot_with_UInt256 = r""" +bitNot(toUInt256(1)) bitNot(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) bitNot(toUInt256(\'0\')) +115792089237316195423570985008687907853269984665640564039457584007913129639934 0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +Check_bitCount_with_Int128 = r""" +bitCount(toInt128(1)) bitCount(toInt128(\'170141183460469231731687303715884105727\')) bitCount(toInt128(\'-170141183460469231731687303715884105728\')) +1 64 0 +""" + +Check_bitCount_with_Int256 = r""" +bitCount(toInt256(1)) bitCount(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) bitCount(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) +1 64 0 +""" + +Check_bitCount_with_UInt128 = r""" +bitCount(toUInt128(1)) bitCount(toUInt128(\'340282366920938463463374607431768211455\')) bitCount(toUInt128(\'0\')) +1 64 0 +""" + +Check_bitCount_with_UInt256 = r""" +bitCount(toUInt256(1)) bitCount(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) bitCount(toUInt256(\'0\')) +1 64 0 +""" + +I_check_the_table_with_values_of_bitAnd_and_Int128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitAnd_and_Int256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitAnd_and_UInt128 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitAnd_and_UInt256 = r""" +a +0 +1 +1 +""" + +I_check_the_table_with_values_of_bitOr_and_Int128 = r""" +a +-170141183460469231731687303715884105727 +1 +170141183460469231731687303715884105727 +""" + +I_check_the_table_with_values_of_bitOr_and_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_with_values_of_bitOr_and_UInt128 = r""" +a +1 +1 +340282366920938463463374607431768211455 +""" + +I_check_the_table_with_values_of_bitOr_and_UInt256 = r""" +a +1 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_with_values_of_bitXor_and_Int128 = r""" +a +-170141183460469231731687303715884105727 +0 +170141183460469231731687303715884105726 +""" + +I_check_the_table_with_values_of_bitXor_and_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819967 +0 +57896044618658097711785492504343953926634992332820282019728792003956564819966 +""" + +I_check_the_table_with_values_of_bitXor_and_UInt128 = r""" +a +0 +1 +340282366920938463463374607431768211454 +""" + +I_check_the_table_with_values_of_bitXor_and_UInt256 = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_Int128 = r""" +a +-2 +0 +2 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_Int256 = r""" +a +-2 +0 +2 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_UInt128 = r""" +a +0 +2 +340282366920938463463374607431768211454 +""" + +I_check_the_table_with_values_of_bitShiftLeft_and_UInt256 = r""" +a +0 +2 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_Int128 = r""" +a +-85070591730234615865843651857942052864 +0 +85070591730234615865843651857942052863 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_Int256 = r""" +a +-28948022309329048855892746252171976963317496166410141009864396001978282409984 +0 +28948022309329048855892746252171976963317496166410141009864396001978282409983 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_UInt128 = r""" +a +0 +0 +170141183460469231731687303715884105727 +""" + +I_check_the_table_with_values_of_bitShiftRight_and_UInt256 = r""" +a +0 +0 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_with_values_of_bitNot_and_Int128 = r""" +a +-170141183460469231731687303715884105728 +-2 +170141183460469231731687303715884105727 +""" + +I_check_the_table_with_values_of_bitNot_and_Int256 = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +-2 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_the_table_with_values_of_bitNot_and_UInt128 = r""" +a +0 +340282366920938463463374607431768211454 +340282366920938463463374607431768211455 +""" + +I_check_the_table_with_values_of_bitNot_and_UInt256 = r""" +a +0 +115792089237316195423570985008687907853269984665640564039457584007913129639934 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_the_table_with_values_of_bitCount_and_Int128 = r""" +a +0 +1 +64 +""" + +I_check_the_table_with_values_of_bitCount_and_Int256 = r""" +a +0 +1 +64 +""" + +I_check_the_table_with_values_of_bitCount_and_UInt128 = r""" +a +0 +1 +64 +""" + +I_check_the_table_with_values_of_bitCount_and_UInt256 = r""" +a +0 +1 +64 +""" + +I_check_isNull__with_Int128_using_min_and_max = r""" +isNull(toInt128(\'-170141183460469231731687303715884105728\')) isNull(toInt128(\'170141183460469231731687303715884105727\')) +0 0 +""" + +I_check_isNull__with_Int256_using_min_and_max = r""" +isNull(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) isNull(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +0 0 +""" + +I_check_isNull__with_UInt128_using_min_and_max = r""" +isNull(toUInt128(\'0\')) isNull(toUInt128(\'340282366920938463463374607431768211455\')) +0 0 +""" + +I_check_isNull__with_UInt256_using_min_and_max = r""" +isNull(toUInt256(\'0\')) isNull(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 0 +""" + +I_check_isNotNull__with_Int128_using_min_and_max = r""" +isNotNull(toInt128(\'-170141183460469231731687303715884105728\')) isNotNull(toInt128(\'170141183460469231731687303715884105727\')) +1 1 +""" + +I_check_isNotNull__with_Int256_using_min_and_max = r""" +isNotNull(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) isNotNull(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +1 1 +""" + +I_check_isNotNull__with_UInt128_using_min_and_max = r""" +isNotNull(toUInt128(\'0\')) isNotNull(toUInt128(\'340282366920938463463374607431768211455\')) +1 1 +""" + +I_check_isNotNull__with_UInt256_using_min_and_max = r""" +isNotNull(toUInt256(\'0\')) isNotNull(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +1 1 +""" + +I_check_coalesce__with_Int128_using_min_and_max = r""" +coalesce(toInt128(\'-170141183460469231731687303715884105728\')) coalesce(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_coalesce__with_Int256_using_min_and_max = r""" +coalesce(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) coalesce(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_coalesce__with_UInt128_using_min_and_max = r""" +coalesce(toUInt128(\'0\')) coalesce(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_coalesce__with_UInt256_using_min_and_max = r""" +coalesce(toUInt256(\'0\')) coalesce(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_assumeNotNull__with_Int128_using_min_and_max = r""" +assumeNotNull(toInt128(\'-170141183460469231731687303715884105728\')) assumeNotNull(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_assumeNotNull__with_Int256_using_min_and_max = r""" +assumeNotNull(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) assumeNotNull(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_assumeNotNull__with_UInt128_using_min_and_max = r""" +assumeNotNull(toUInt128(\'0\')) assumeNotNull(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_assumeNotNull__with_UInt256_using_min_and_max = r""" +assumeNotNull(toUInt256(\'0\')) assumeNotNull(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_toNullable__with_Int128_using_min_and_max = r""" +toNullable(toInt128(\'-170141183460469231731687303715884105728\')) toNullable(toInt128(\'170141183460469231731687303715884105727\')) +-170141183460469231731687303715884105728 170141183460469231731687303715884105727 +""" + +I_check_toNullable__with_Int256_using_min_and_max = r""" +toNullable(toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) toNullable(toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +-57896044618658097711785492504343953926634992332820282019728792003956564819968 57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_toNullable__with_UInt128_using_min_and_max = r""" +toNullable(toUInt128(\'0\')) toNullable(toUInt128(\'340282366920938463463374607431768211455\')) +0 340282366920938463463374607431768211455 +""" + +I_check_toNullable__with_UInt256_using_min_and_max = r""" +toNullable(toUInt256(\'0\')) toNullable(toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +0 115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_ifNull_1__with_Int128_using_min_and_max = r""" +ifNull(1, toInt128(\'-170141183460469231731687303715884105728\')) ifNull(1, toInt128(\'170141183460469231731687303715884105727\')) +1 1 +""" + +I_check_ifNull_1__with_Int256_using_min_and_max = r""" +ifNull(1, toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) ifNull(1, toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +1 1 +""" + +I_check_ifNull_1__with_UInt128_using_min_and_max = r""" +ifNull(1, toUInt128(\'0\')) ifNull(1, toUInt128(\'340282366920938463463374607431768211455\')) +1 1 +""" + +I_check_ifNull_1__with_UInt256_using_min_and_max = r""" +ifNull(1, toUInt256(\'0\')) ifNull(1, toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +1 1 +""" + +I_check_nullIf_1__with_Int128_using_min_and_max = r""" +nullIf(1, toInt128(\'-170141183460469231731687303715884105728\')) nullIf(1, toInt128(\'170141183460469231731687303715884105727\')) +1 1 +""" + +I_check_nullIf_1__with_Int256_using_min_and_max = r""" +nullIf(1, toInt256(\'-57896044618658097711785492504343953926634992332820282019728792003956564819968\')) nullIf(1, toInt256(\'57896044618658097711785492504343953926634992332820282019728792003956564819967\')) +1 1 +""" + +I_check_nullIf_1__with_UInt128_using_min_and_max = r""" +nullIf(1, toUInt128(\'0\')) nullIf(1, toUInt128(\'340282366920938463463374607431768211455\')) +1 1 +""" + +I_check_nullIf_1__with_UInt256_using_min_and_max = r""" +nullIf(1, toUInt256(\'0\')) nullIf(1, toUInt256(\'115792089237316195423570985008687907853269984665640564039457584007913129639935\')) +1 1 +""" + +I_check_isNull__with_Int128_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNull__with_Int256_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNull__with_UInt128_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNull__with_UInt256_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNotNull__with_Int128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_isNotNull__with_Int256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_isNotNull__with_UInt128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_isNotNull__with_UInt256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_coalesce__with_Int128_on_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_coalesce__with_Int256_on_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_coalesce__with_UInt128_on_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_coalesce__with_UInt256_on_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_assumeNotNull__with_Int128_on_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_assumeNotNull__with_Int256_on_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_assumeNotNull__with_UInt128_on_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_assumeNotNull__with_UInt256_on_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_toNullable__with_Int128_on_the_table = r""" +a +-170141183460469231731687303715884105728 +1 +170141183460469231731687303715884105727 +""" + +I_check_toNullable__with_Int256_on_the_table = r""" +a +-57896044618658097711785492504343953926634992332820282019728792003956564819968 +1 +57896044618658097711785492504343953926634992332820282019728792003956564819967 +""" + +I_check_toNullable__with_UInt128_on_the_table = r""" +a +0 +1 +340282366920938463463374607431768211455 +""" + +I_check_toNullable__with_UInt256_on_the_table = r""" +a +0 +1 +115792089237316195423570985008687907853269984665640564039457584007913129639935 +""" + +I_check_ifNull_1__with_Int128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_ifNull_1__with_Int256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_ifNull_1__with_UInt128_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_ifNull_1__with_UInt256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_nullIf_1__with_Int128_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_nullIf_1__with_Int256_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_nullIf_1__with_UInt128_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_nullIf_1__with_UInt256_on_the_table = r""" +a +1 +1 +\N +""" + +I_check_isNull__with_Decimal256_using_min_and_max = r""" +isNull(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) isNull(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +0 0 +""" + +I_check_isNotNull__with_Decimal256_using_min_and_max = r""" +isNotNull(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) isNotNull(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_coalesce__with_Decimal256_using_min_and_max = r""" +coalesce(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) coalesce(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_assumeNotNull__with_Decimal256_using_min_and_max = r""" +assumeNotNull(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) assumeNotNull(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_toNullable__with_Decimal256_using_min_and_max = r""" +toNullable(toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) toNullable(toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +-1000000000000000000000000000000000000000000000000000000000000000000000000000 1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_ifNull_1__with_Decimal256_using_min_and_max = r""" +ifNull(1, toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) ifNull(1, toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_nullIf_1__with_Decimal256_using_min_and_max = r""" +nullIf(1, toDecimal256(\'-1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) nullIf(1, toDecimal256(\'1000000000000000000000000000000000000000000000000000000000000000000000000000\', 0)) +1 1 +""" + +I_check_isNull__with_Decimal256_on_the_table = r""" +a +0 +0 +0 +""" + +I_check_isNotNull__with_Decimal256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_coalesce__with_Decimal256_on_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_assumeNotNull__with_Decimal256_on_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_toNullable__with_Decimal256_on_the_table = r""" +a +-1000000000000000000000000000000000000000000000000000000000000000000000000000 +1 +1000000000000000000000000000000000000000000000000000000000000000000000000000 +""" + +I_check_ifNull_1__with_Decimal256_on_the_table = r""" +a +1 +1 +1 +""" + +I_check_nullIf_1__with_Decimal256_on_the_table = r""" +a +1 +1 +\N +""" + diff --git a/tests/testflows/extended_precision_data_types/tests/arithmetic.py b/tests/testflows/extended_precision_data_types/tests/arithmetic.py index e949ef65f53..5a0508db9e9 100644 --- a/tests/testflows/extended_precision_data_types/tests/arithmetic.py +++ b/tests/testflows/extended_precision_data_types/tests/arithmetic.py @@ -37,6 +37,9 @@ def inline_check(self, arithmetic_func, expected_result, int_type, min, max, nod if node is None: node = self.context.node + if arithmetic_func == "divide": + skip("divide is not supported for int types") + if arithmetic_func in ["negate", "abs"]: with When(f"I check {arithmetic_func} with {int_type}"): @@ -92,6 +95,9 @@ def table_check(self, arithmetic_func, expected_result, int_type, min, max, node table_name = f"table_{getuid()}" + if arithmetic_func == "divide": + skip("divide is not supported for int types") + with Given(f"I have a table"): table(name=table_name, data_type=int_type) diff --git a/tests/testflows/extended_precision_data_types/tests/array_tuple_map.py b/tests/testflows/extended_precision_data_types/tests/array_tuple_map.py index 106458d58bc..457c9caba3c 100644 --- a/tests/testflows/extended_precision_data_types/tests/array_tuple_map.py +++ b/tests/testflows/extended_precision_data_types/tests/array_tuple_map.py @@ -2,6 +2,7 @@ from extended_precision_data_types.requirements import * from extended_precision_data_types.common import * +from helpers.common import check_clickhouse_version def get_table_name(): @@ -477,11 +478,16 @@ def map_func(self, data_type, node=None): ) exitcode, message = 0, None - if data_type.startswith("Decimal"): - exitcode, message = 44, "Exception:" + if data_type.startswith("Decimal") or check_clickhouse_version("<21.9")(self): + (exitcode, message) = ( + (44, "Exception:") + if check_clickhouse_version("<22.3")(self) + else (43, "Exception:") + ) node.query(sql, exitcode=exitcode, message=message) with Scenario(f"mapPopulateSeries with {data_type} on a table"): + table_name = get_table_name() table( @@ -496,10 +502,15 @@ def map_func(self, data_type, node=None): exitcode, message = 0, None if data_type.startswith("Decimal"): - exitcode, message = 44, "Exception:" + (exitcode, message) = ( + (44, "Exception:") + if check_clickhouse_version("<22.3")(self) + else (43, "Exception:") + ) node.query(sql, exitcode=exitcode, message=message) - execute_query(f"SELECT * FROM {table_name} ORDER BY a ASC") + if check_clickhouse_version(">=21.9")(self): + execute_query(f"SELECT * FROM {table_name} ORDER BY a ASC") with Scenario(f"mapContains with {data_type}"): node.query( diff --git a/tests/testflows/helpers/argparser.py b/tests/testflows/helpers/argparser.py index ec26b8f654b..763d455a7a0 100644 --- a/tests/testflows/helpers/argparser.py +++ b/tests/testflows/helpers/argparser.py @@ -7,7 +7,7 @@ def argparser(parser): "--local", action="store_true", help="run regression in local mode", - default=False, + default=True, ) parser.add_argument( diff --git a/tests/testflows/helpers/cluster.py b/tests/testflows/helpers/cluster.py index ae9f9d6623e..138c0af0a38 100755 --- a/tests/testflows/helpers/cluster.py +++ b/tests/testflows/helpers/cluster.py @@ -14,6 +14,7 @@ from testflows.connect import Shell as ShellBase from testflows.uexpect import ExpectTimeoutError from testflows._core.testtype import TestSubType +from helpers.common import check_clickhouse_version, current_cpu MESSAGES_TO_RETRY = [ "DB::Exception: ZooKeeper session has been expired", @@ -72,7 +73,7 @@ def close_bashes(self): """Close all active bashes to the node.""" with self.cluster.lock: for key in list(self.cluster._bash.keys()): - if key.endswith(f"-{self.name}"): + if key[1].endswith(f"{self.name}"): shell = self.cluster._bash.pop(key) shell.__exit__(None, None, None) @@ -169,8 +170,8 @@ def cmd( class ClickHouseNode(Node): """Node with ClickHouse server.""" - def thread_fuzzer(self): - with Given("exporting THREAD_FUZZER"): + def enable_thread_fuzzer(self): + with Given("enabling THREAD_FUZZER"): self.command("export THREAD_FUZZER_CPU_TIME_PERIOD_US=1000") self.command("export THREAD_FUZZER_SLEEP_PROBABILITY=0.1") self.command("export THREAD_FUZZER_SLEEP_TIME_US=100000") @@ -230,7 +231,7 @@ def wait_clickhouse_healthy(self, timeout=300): if current().context.clickhouse_version is None: current().context.clickhouse_version = node_version else: - assert current().context.clickhouse_version == node_version, error() + assert check_clickhouse_version(f"={node_version}")(current()), error() def clickhouse_pid(self): """Return ClickHouse server pid if present @@ -283,7 +284,7 @@ def start_clickhouse( raise RuntimeError(f"ClickHouse server already running with pid {pid}") if thread_fuzzer: - self.thread_fuzzer() + self.enable_thread_fuzzer() if user is None: with By("starting ClickHouse server process"): @@ -521,6 +522,7 @@ def query( messages_to_retry=None, retry_delay=5, secure=False, + max_query_output_in_bytes="-0", *args, **kwargs, ): @@ -537,12 +539,16 @@ def query( which retry should be triggered, default: MESSAGES_TO_RETRY :param retry_delay: number of seconds to sleep before retry, default: 5 :param secure: use secure connection, default: False + :param max_query_output_in_bytes: truncate query output the specified number of bytes using 'head' command utility, default: -0 (do not truncate any output) """ retry_count = max(0, int(retry_count)) retry_delay = max(0, float(retry_delay)) settings = list(settings or []) query_settings = list(settings) + if raise_on_exception: + steps = False + if messages_to_retry is None: messages_to_retry = MESSAGES_TO_RETRY @@ -557,10 +563,14 @@ def query( with tempfile.NamedTemporaryFile("w", encoding="utf-8") as query: query.write(sql) query.flush() - command = f'cat "{query.name}" | {self.cluster.docker_compose} exec -T {self.name} {client}' + + client_options = "" for setting in query_settings: name, value = setting - command += f' --{name} "{value}"' + client_options += f' --{name} "{value}"' + + command = f'cat "{query.name}" | {self.cluster.docker_compose} exec -T {self.name} bash -c "(set -o pipefail && {client}{client_options} 2>&1 | head -c {max_query_output_in_bytes})"' + description = f""" echo -e \"{sql[:100]}...\" > {query.name} {command} @@ -576,10 +586,13 @@ def query( self.cluster.close_bash(None) raise else: - command = f'echo -e "{sql}" | {client}' + client_options = "" for setting in query_settings: name, value = setting - command += f' --{name} "{value}"' + client_options += f' --{name} "{value}"' + + command = f'(set -o pipefail && echo -e "{sql}" | {client}{client_options} 2>&1 | head -c {max_query_output_in_bytes})' + with step( "executing command", description=command, format_description=False ) if steps else NullStep(): @@ -644,6 +657,7 @@ def __init__( docker_compose_project_dir=None, docker_compose_file="docker-compose.yml", environ=None, + thread_fuzzer=False, ): self._bash = {} @@ -655,6 +669,8 @@ def __init__( self.local = local self.nodes = nodes or {} self.docker_compose = docker_compose + self.thread_fuzzer = thread_fuzzer + self.running = False frame = inspect.currentframe().f_back caller_dir = os.path.dirname(os.path.abspath(frame.f_globals["__file__"])) @@ -668,11 +684,20 @@ def __init__( if not os.path.exists(self.configs_dir): raise TypeError(f"configs directory '{self.configs_dir}' does not exist") - if docker_compose_project_dir is None: + if not docker_compose_project_dir: raise TypeError("docker compose directory must be specified.") + if current_cpu() == "aarch64": + if not docker_compose_project_dir.endswith("_arm64"): + docker_compose_project_dir += f"_arm64" + + if not os.path.exists(docker_compose_project_dir): + raise TypeError( + f"docker compose project directory '{docker_compose_project_dir}' does not exist" + ) + docker_compose_file_path = os.path.join( - docker_compose_project_dir or "", docker_compose_file + docker_compose_project_dir, docker_compose_file ) if not os.path.exists(docker_compose_file_path): @@ -680,25 +705,28 @@ def __init__( f"docker compose file '{docker_compose_file_path}' does not exist" ) - if self.clickhouse_binary_path and self.clickhouse_binary_path.startswith( - "docker://" - ): - if current().context.clickhouse_version is None: - try: - current().context.clickhouse_version = ( - self.clickhouse_binary_path.split(":")[2] - ) - debug( - f"auto setting clickhouse version to {current().context.clickhouse_version}" - ) - except IndexError: - current().context.clickhouse_version = None - ( - self.clickhouse_binary_path, - self.clickhouse_odbc_bridge_binary_path, - ) = self.get_clickhouse_binary_from_docker_container( - self.clickhouse_binary_path - ) + if self.clickhouse_binary_path: + if self.clickhouse_binary_path.startswith("docker://"): + if current().context.clickhouse_version is None: + parsed_version = "" + for c in self.clickhouse_binary_path.rsplit(":", 1)[-1]: + if c in ".0123456789": + parsed_version += c + else: + break + if parsed_version: + if not ( + parsed_version.startswith(".") + or parsed_version.endswith(".") + ): + current().context.clickhouse_version = parsed_version + + ( + self.clickhouse_binary_path, + self.clickhouse_odbc_bridge_binary_path, + ) = self.get_clickhouse_binary_from_docker_container( + self.clickhouse_binary_path + ) self.docker_compose += f' --ansi never --project-directory "{docker_compose_project_dir}" --file "{docker_compose_file_path}"' self.lock = threading.Lock() @@ -754,18 +782,21 @@ def control_shell(self, timeout=300): return self._control_shell time_start = time.time() + i = -1 while True: - try: - shell = Shell() - shell.timeout = 30 - shell("echo 1") - break - except IOError: - raise - except Exception as exc: - shell.__exit__(None, None, None) - if time.time() - time_start > timeout: - raise RuntimeError(f"failed to open control shell") + i += 1 + with By(f"attempt #{i}"): + try: + shell = Shell() + shell.timeout = 30 + shell("echo 1") + break + except IOError: + raise + except Exception as exc: + shell.__exit__(None, None, None) + if time.time() - time_start > timeout: + raise RuntimeError(f"failed to open control shell") self._control_shell = shell return self._control_shell @@ -781,23 +812,26 @@ def node_container_id(self, node, timeout=300): """Must be called with self.lock acquired.""" container_id = None time_start = time.time() + i = -1 while True: - try: - c = self.control_shell( - f"{self.docker_compose} ps -q {node}", timeout=timeout - ) - container_id = c.output.strip() - if c.exitcode == 0 and len(container_id) > 1: - break - except IOError: - raise - except ExpectTimeoutError: - self.close_control_shell() - timeout = timeout - (time.time() - time_start) - if timeout <= 0: - raise RuntimeError( - f"failed to get docker container id for the {node} service" + i += 1 + with By(f"attempt #{i}"): + try: + c = self.control_shell( + f"{self.docker_compose} ps -q {node}", timeout=timeout ) + container_id = c.output.strip() + if c.exitcode == 0 and len(container_id) > 1: + break + except IOError: + raise + except ExpectTimeoutError: + self.close_control_shell() + timeout = timeout - (time.time() - time_start) + if timeout <= 0: + raise RuntimeError( + f"failed to get docker container id for the {node} service" + ) return container_id def shell(self, node, timeout=300): @@ -809,29 +843,32 @@ def shell(self, node, timeout=300): container_id = self.node_container_id(node=node, timeout=timeout) time_start = time.time() + i = -1 while True: - try: - if node is None: - shell = Shell() - else: - shell = Shell( - command=[ - "/bin/bash", - "--noediting", - "-c", - f"docker exec -it {container_id} bash --noediting", - ], - name=node, - ) - shell.timeout = 30 - shell("echo 1") - break - except IOError: - raise - except Exception as exc: - shell.__exit__(None, None, None) - if time.time() - time_start > timeout: - raise RuntimeError(f"failed to open bash to node {node}") + i += 1 + with By(f"attempt #{i}"): + try: + if node is None: + shell = Shell() + else: + shell = Shell( + command=[ + "/bin/bash", + "--noediting", + "-c", + f"docker exec -it {container_id} bash --noediting", + ], + name=node, + ) + shell.timeout = 30 + shell("echo 1") + break + except IOError: + raise + except Exception as exc: + shell.__exit__(None, None, None) + if time.time() - time_start > timeout: + raise RuntimeError(f"failed to open bash to node {node}") shell.timeout = timeout return shell @@ -844,7 +881,7 @@ def bash(self, node, timeout=300, command="bash --noediting"): test = current() current_thread = threading.current_thread() - id = f"{current_thread.name}-{node}" + id = (current_thread.name, f"{node}") with self.lock: if self._bash.get(id) is None: @@ -852,29 +889,34 @@ def bash(self, node, timeout=300, command="bash --noediting"): container_id = self.node_container_id(node=node, timeout=timeout) time_start = time.time() + i = -1 while True: - try: - if node is None: - self._bash[id] = Shell() - else: - self._bash[id] = Shell( - command=[ - "/bin/bash", - "--noediting", - "-c", - f"docker exec -it {container_id} {command}", - ], - name=node, - ).__enter__() - self._bash[id].timeout = 30 - self._bash[id]("echo 1") - break - except IOError: - raise - except Exception as exc: - self._bash[id].__exit__(None, None, None) - if time.time() - time_start > timeout: - raise RuntimeError(f"failed to open bash to node {node}") + i += 1 + with By(f"attempt #{i}"): + try: + if node is None: + self._bash[id] = Shell() + else: + self._bash[id] = Shell( + command=[ + "/bin/bash", + "--noediting", + "-c", + f"docker exec -it {container_id} {command}", + ], + name=node, + ).__enter__() + self._bash[id].timeout = 30 + self._bash[id]("echo 1") + break + except IOError: + raise + except Exception as exc: + self._bash[id].__exit__(None, None, None) + if time.time() - time_start > timeout: + raise RuntimeError( + f"failed to open bash to node {node}" + ) if node is None: for name, value in self.environ.items(): @@ -886,7 +928,7 @@ def bash(self, node, timeout=300, command="bash --noediting"): active_thread_names = {thread.name for thread in threading.enumerate()} for bash_id in list(self._bash.keys()): - thread_name, node_name = bash_id.rsplit("-", 1) + thread_name, node_name = bash_id if thread_name not in active_thread_names: self._bash[bash_id].__exit__(None, None, None) del self._bash[bash_id] @@ -895,7 +937,7 @@ def bash(self, node, timeout=300, command="bash --noediting"): def close_bash(self, node): current_thread = threading.current_thread() - id = f"{current_thread.name}-{node}" + id = (current_thread.name, f"{node}") with self.lock: if self._bash.get(id) is None: @@ -929,7 +971,7 @@ def down(self, timeout=300): """Bring cluster down by executing docker-compose down.""" # add message to each clickhouse-server.log - if settings.debug: + if settings.debug and self.running: for node in self.nodes["clickhouse"]: self.command( node=node, @@ -970,6 +1012,7 @@ def temp_file(self, name): return f"{os.path.join(self.temp_path(), name)}" def up(self, timeout=30 * 60): + """Bring cluster up.""" if self.local: with Given("I am running in local mode"): with Then("check --clickhouse-binary-path is specified"): @@ -980,6 +1023,9 @@ def up(self, timeout=30 * 60): assert os.path.exists(self.clickhouse_binary_path) with And("I set all the necessary environment variables"): + self.environ["IMAGE_DEPENDENCY_PROXY"] = os.getenv( + "IMAGE_DEPENDENCY_PROXY", "" + ) self.environ["COMPOSE_HTTP_TIMEOUT"] = "300" self.environ[ "CLICKHOUSE_TESTS_SERVER_BIN_PATH" @@ -1064,7 +1110,9 @@ def up(self, timeout=30 * 60): for name in self.nodes["clickhouse"]: self.node(name).wait_healthy() if name.startswith("clickhouse"): - self.node(name).start_clickhouse() + self.node(name).start_clickhouse(thread_fuzzer=self.thread_fuzzer) + + self.running = True def command( self, diff --git a/tests/testflows/helpers/common.py b/tests/testflows/helpers/common.py index 2ba6aef11ee..358d71081b3 100644 --- a/tests/testflows/helpers/common.py +++ b/tests/testflows/helpers/common.py @@ -1,8 +1,8 @@ import os import uuid import time +import platform import xml.etree.ElementTree as xmltree -import packaging.version as pkg_version from collections import namedtuple import testflows.settings as settings @@ -12,6 +12,11 @@ from testflows._core.testtype import TestSubType +def current_cpu(): + """Return current cpu architecture.""" + return platform.processor() + + def check_clickhouse_version(version): """Compare ClickHouse version.""" @@ -19,34 +24,39 @@ def check(test): if getattr(test.context, "clickhouse_version", None) is None: return False - clickhouse_version = pkg_version.parse(str(test.context.clickhouse_version)) + version_list = version.translate({ord(i): None for i in "<>="}).split(".") + clickhouse_version_list = test.context.clickhouse_version.split(".") + + index = None + + for i in clickhouse_version_list: + if i.isnumeric(): + continue + index = clickhouse_version_list.index(i) + + index = ( + min(len(version_list), len(clickhouse_version_list)) + if index is None + else min(len(version_list), index) + ) + + version_list = [int(i) for i in version_list[0:index]] + clickhouse_version_list = [int(i) for i in clickhouse_version_list[0:index]] if version.startswith("=="): - return clickhouse_version == pkg_version.parse( - str(version.split("==", 1)[-1]) - ) + return clickhouse_version_list == version_list elif version.startswith(">="): - return clickhouse_version >= pkg_version.parse( - str(version.split(">=", 1)[-1]) - ) + return clickhouse_version_list >= version_list elif version.startswith("<="): - return clickhouse_version <= pkg_version.parse( - str(version.split("<=", 1)[-1]) - ) + return clickhouse_version_list <= version_list elif version.startswith("="): - return clickhouse_version == pkg_version.parse( - str(version.split("=", 1)[-1]) - ) + return clickhouse_version_list == version_list elif version.startswith(">"): - return clickhouse_version > pkg_version.parse( - str(version.split(">", 1)[-1]) - ) + return clickhouse_version_list > version_list elif version.startswith("<"): - return clickhouse_version < pkg_version.parse( - str(version.split("<", 1)[-1]) - ) + return clickhouse_version_list < version_list else: - return clickhouse_version == pkg_version.parse(str(version)) + return clickhouse_version_list == version_list return check @@ -186,7 +196,7 @@ def create_xml_config_content( uid = getuid() path = os.path.join(config_d_dir, config_file) name = config_file - root = xmltree.Element("clickhouse") + root = xmltree.Element("yandex") root.append(xmltree.Comment(text=f"config uid: {uid}")) def create_xml_tree(entries, root): @@ -389,15 +399,24 @@ def wait_for_config_to_be_loaded(user=None): with Then("I wait for config reload message in the log file"): if restart: - bash.expect( - f"ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performed update on configuration", + choice = bash.expect( + ( + f"(ConfigReloader: Loaded config '/etc/clickhouse-server/config.xml', performed update on configuration)|" + f"(ConfigReloader: Error updating configuration from '/etc/clickhouse-server/config.xml')" + ), timeout=timeout, ) else: - bash.expect( - f"ConfigReloader: Loaded config '/etc/clickhouse-server/{config.preprocessed_name}', performed update on configuration", + choice = bash.expect( + ( + f"(ConfigReloader: Loaded config '/etc/clickhouse-server/{config.preprocessed_name}', performed update on configuration)|" + f"(ConfigReloader: Error updating configuration from '/etc/clickhouse-server/{config.preprocessed_name}')" + ), timeout=timeout, ) + if choice.group(2): + bash.expect(".+\n", timeout=5, expect_timeout=True) + fail("ConfigReloader: Error updating configuration") try: with Given(f"{config.name}"): @@ -456,7 +475,7 @@ def wait_for_config_to_be_loaded(user=None): wait_for_config_to_be_loaded() -@TestStep(When) +@TestStep(Given) def copy( self, dest_node, @@ -477,8 +496,12 @@ def copy( assert cmd.exitcode == 0, error() contents = cmd.output - - dest_node.command(f"cat << {eof} > {dest_path}\n{contents}\n{eof}") + try: + dest_node.command(f"cat << {eof} > {dest_path}\n{contents}\n{eof}") + yield dest_path + finally: + with Finally(f"I delete {dest_path}"): + dest_node.command(f"rm -rf {dest_path}") @TestStep(Given) diff --git a/tests/testflows/kerberos/configs/clickhouse/common.xml b/tests/testflows/kerberos/configs/clickhouse/common.xml new file mode 100644 index 00000000000..df952b28c82 --- /dev/null +++ b/tests/testflows/kerberos/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + 0.0.0.0 + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/kerberos/configs/clickhouse/config.d/logs.xml b/tests/testflows/kerberos/configs/clickhouse/config.d/logs.xml index 2ee8bb55f38..bdf1bbc11c1 100644 --- a/tests/testflows/kerberos/configs/clickhouse/config.d/logs.xml +++ b/tests/testflows/kerberos/configs/clickhouse/config.d/logs.xml @@ -1,4 +1,4 @@ - + 3 trace @@ -14,4 +14,4 @@ part_log
500 -
+ diff --git a/tests/testflows/kerberos/configs/clickhouse/config.d/ports.xml b/tests/testflows/kerberos/configs/clickhouse/config.d/ports.xml index 1e061e2252e..fbc6cea74c0 100644 --- a/tests/testflows/kerberos/configs/clickhouse/config.d/ports.xml +++ b/tests/testflows/kerberos/configs/clickhouse/config.d/ports.xml @@ -1,5 +1,5 @@ - + 8443 9440 - \ No newline at end of file + \ No newline at end of file diff --git a/tests/testflows/kerberos/configs/clickhouse/config.d/remote.xml b/tests/testflows/kerberos/configs/clickhouse/config.d/remote.xml index 04066290061..51be2a6e8e3 100644 --- a/tests/testflows/kerberos/configs/clickhouse/config.d/remote.xml +++ b/tests/testflows/kerberos/configs/clickhouse/config.d/remote.xml @@ -1,5 +1,5 @@ - + @@ -104,4 +104,4 @@ - + diff --git a/tests/testflows/kerberos/configs/clickhouse/config.d/ssl.xml b/tests/testflows/kerberos/configs/clickhouse/config.d/ssl.xml index 77e03e9cf0f..ca65ffd5e04 100644 --- a/tests/testflows/kerberos/configs/clickhouse/config.d/ssl.xml +++ b/tests/testflows/kerberos/configs/clickhouse/config.d/ssl.xml @@ -1,4 +1,4 @@ - + /etc/clickhouse-server/ssl/server.crt @@ -14,4 +14,4 @@ - + diff --git a/tests/testflows/kerberos/configs/clickhouse/config.d/storage.xml b/tests/testflows/kerberos/configs/clickhouse/config.d/storage.xml index 0c53fd70593..618fd6b6d24 100644 --- a/tests/testflows/kerberos/configs/clickhouse/config.d/storage.xml +++ b/tests/testflows/kerberos/configs/clickhouse/config.d/storage.xml @@ -1,4 +1,4 @@ - + @@ -17,4 +17,4 @@ - + diff --git a/tests/testflows/kerberos/configs/clickhouse/config.d/zookeeper.xml b/tests/testflows/kerberos/configs/clickhouse/config.d/zookeeper.xml index 1d5c0b6cb8b..96270e7b645 100644 --- a/tests/testflows/kerberos/configs/clickhouse/config.d/zookeeper.xml +++ b/tests/testflows/kerberos/configs/clickhouse/config.d/zookeeper.xml @@ -1,5 +1,5 @@ - + zookeeper @@ -7,4 +7,4 @@ 15000 - + diff --git a/tests/testflows/kerberos/configs/clickhouse/config.xml b/tests/testflows/kerberos/configs/clickhouse/config.xml new file mode 100644 index 00000000000..854e9deaaa5 --- /dev/null +++ b/tests/testflows/kerberos/configs/clickhouse/config.xml @@ -0,0 +1,440 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + 0.0.0.0 + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/kerberos/configs/clickhouse/users.xml b/tests/testflows/kerberos/configs/clickhouse/users.xml new file mode 100644 index 00000000000..86b2cd9e1e3 --- /dev/null +++ b/tests/testflows/kerberos/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/kerberos/configs/clickhouse1/config.d/kerberos.xml b/tests/testflows/kerberos/configs/clickhouse1/config.d/kerberos.xml index 93ae1a31534..e45c4519c73 100644 --- a/tests/testflows/kerberos/configs/clickhouse1/config.d/kerberos.xml +++ b/tests/testflows/kerberos/configs/clickhouse1/config.d/kerberos.xml @@ -1,6 +1,6 @@ - + EXAMPLE.COM - + diff --git a/tests/testflows/kerberos/configs/clickhouse1/config.d/macros.xml b/tests/testflows/kerberos/configs/clickhouse1/config.d/macros.xml index c59a85cad8f..6cdcc1b440c 100644 --- a/tests/testflows/kerberos/configs/clickhouse1/config.d/macros.xml +++ b/tests/testflows/kerberos/configs/clickhouse1/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse1 01 01 - + diff --git a/tests/testflows/kerberos/configs/clickhouse1/users.d/kerberos-users.xml b/tests/testflows/kerberos/configs/clickhouse1/users.d/kerberos-users.xml index 60d2bba71bb..7029f20217f 100644 --- a/tests/testflows/kerberos/configs/clickhouse1/users.d/kerberos-users.xml +++ b/tests/testflows/kerberos/configs/clickhouse1/users.d/kerberos-users.xml @@ -1,4 +1,4 @@ - + @@ -7,4 +7,4 @@ 1 - \ No newline at end of file + \ No newline at end of file diff --git a/tests/testflows/kerberos/configs/clickhouse2/config.d/kerberos.xml b/tests/testflows/kerberos/configs/clickhouse2/config.d/kerberos.xml index 703aa6c8a8d..ceaa497c561 100644 --- a/tests/testflows/kerberos/configs/clickhouse2/config.d/kerberos.xml +++ b/tests/testflows/kerberos/configs/clickhouse2/config.d/kerberos.xml @@ -1,5 +1,5 @@ - + EXAMPLE.COM - \ No newline at end of file + \ No newline at end of file diff --git a/tests/testflows/kerberos/configs/clickhouse2/config.d/macros.xml b/tests/testflows/kerberos/configs/clickhouse2/config.d/macros.xml index 1f880da0f65..a114a9ce4ab 100644 --- a/tests/testflows/kerberos/configs/clickhouse2/config.d/macros.xml +++ b/tests/testflows/kerberos/configs/clickhouse2/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse2 01 02 - + diff --git a/tests/testflows/kerberos/configs/clickhouse3/config.d/kerberos.xml b/tests/testflows/kerberos/configs/clickhouse3/config.d/kerberos.xml index 93ae1a31534..e45c4519c73 100644 --- a/tests/testflows/kerberos/configs/clickhouse3/config.d/kerberos.xml +++ b/tests/testflows/kerberos/configs/clickhouse3/config.d/kerberos.xml @@ -1,6 +1,6 @@ - + EXAMPLE.COM - + diff --git a/tests/testflows/kerberos/configs/clickhouse3/config.d/macros.xml b/tests/testflows/kerberos/configs/clickhouse3/config.d/macros.xml index d2f1dbafa04..904a27b0172 100644 --- a/tests/testflows/kerberos/configs/clickhouse3/config.d/macros.xml +++ b/tests/testflows/kerberos/configs/clickhouse3/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse3 01 03 - + diff --git a/tests/testflows/kerberos/kerberos_env/clickhouse-service.yml b/tests/testflows/kerberos/kerberos_env/clickhouse-service.yml index 45b975db00d..3e27ee9c161 100644 --- a/tests/testflows/kerberos/kerberos_env/clickhouse-service.yml +++ b/tests/testflows/kerberos/kerberos_env/clickhouse-service.yml @@ -2,7 +2,8 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 + init: true expose: - "9000" - "9009" @@ -14,9 +15,9 @@ services: - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" - "${CLICKHOUSE_TESTS_DIR}/configs/kerberos/etc/krb5.conf:/etc/krb5.conf" - entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + entrypoint: bash -c "tail -f /dev/null" healthcheck: - test: clickhouse client --query='select 1' + test: echo 1 interval: 10s timeout: 10s retries: 3 diff --git a/tests/testflows/kerberos/kerberos_env/docker-compose.yml b/tests/testflows/kerberos/kerberos_env/docker-compose.yml index e89d18a5299..e92d12275ce 100644 --- a/tests/testflows/kerberos/kerberos_env/docker-compose.yml +++ b/tests/testflows/kerberos/kerberos_env/docker-compose.yml @@ -61,7 +61,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/kerberos/kerberos_env/kerberos-service.yml b/tests/testflows/kerberos/kerberos_env/kerberos-service.yml index b34751258da..71dda230372 100644 --- a/tests/testflows/kerberos/kerberos_env/kerberos-service.yml +++ b/tests/testflows/kerberos/kerberos_env/kerberos-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: kerberos: - image: zvonand/docker-krb5-server:1.0.0 + image: registry.gitlab.com/altinity-public/container-images/docker-krb5-server:1.0 expose: - "88" - "464" diff --git a/tests/testflows/kerberos/kerberos_env/zookeeper-service.yml b/tests/testflows/kerberos/kerberos_env/zookeeper-service.yml index 6691a2df31c..33cc799ab4c 100644 --- a/tests/testflows/kerberos/kerberos_env/zookeeper-service.yml +++ b/tests/testflows/kerberos/kerberos_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/kerberos/kerberos_env_arm64/clickhouse-service.yml b/tests/testflows/kerberos/kerberos_env_arm64/clickhouse-service.yml new file mode 100644 index 00000000000..f8688ad4ef7 --- /dev/null +++ b/tests/testflows/kerberos/kerberos_env_arm64/clickhouse-service.yml @@ -0,0 +1,32 @@ +version: '2.3' + +services: + clickhouse: + image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:21.12 + expose: + - "9000" + - "9009" + - "8123" + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/ssl:/etc/clickhouse-server/ssl" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" + - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" + - "${CLICKHOUSE_TESTS_DIR}/configs/kerberos/etc/krb5.conf:/etc/krb5.conf" + entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + healthcheck: + test: clickhouse client --query='select 1' + interval: 10s + timeout: 10s + retries: 3 + start_period: 300s + + environment: + KRB5_CLIENT_KTNAME: /etc/krb5.keytab + KRB5_KTNAME: /etc/krb5.keytab + + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/tests/testflows/kerberos/kerberos_env_arm64/docker-compose.yml b/tests/testflows/kerberos/kerberos_env_arm64/docker-compose.yml new file mode 100644 index 00000000000..e92d12275ce --- /dev/null +++ b/tests/testflows/kerberos/kerberos_env_arm64/docker-compose.yml @@ -0,0 +1,80 @@ +version: '2.3' + +services: + + zookeeper: + extends: + file: zookeeper-service.yml + service: zookeeper + + kerberos: + extends: + file: kerberos-service.yml + service: kerberos + hostname: kerberos + depends_on: + zookeeper: + condition: service_healthy + + clickhouse1: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/config.d:/etc/clickhouse-server/config.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/users.d:/etc/clickhouse-server/users.d" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse2: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse2 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/config.d:/etc/clickhouse-server/config.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/users.d:/etc/clickhouse-server/users.d" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse3: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse3 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/config.d:/etc/clickhouse-server/config.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/users.d:/etc/clickhouse-server/users.d" + depends_on: + zookeeper: + condition: service_healthy + + # dummy service which does nothing, but allows to postpone + # 'docker-compose up -d' till all dependecies will go healthy + all_services_ready: + image: ${IMAGE_DEPENDENCY_PROXY}hello-world + depends_on: + clickhouse1: + condition: service_healthy + clickhouse2: + condition: service_healthy + clickhouse3: + condition: service_healthy + zookeeper: + condition: service_healthy + kerberos: + condition: service_healthy + +networks: + default: + name: krbnet + driver: bridge diff --git a/tests/testflows/kerberos/kerberos_env_arm64/kerberos-service.yml b/tests/testflows/kerberos/kerberos_env_arm64/kerberos-service.yml new file mode 100644 index 00000000000..4e5faab92f2 --- /dev/null +++ b/tests/testflows/kerberos/kerberos_env_arm64/kerberos-service.yml @@ -0,0 +1,26 @@ +version: '2.3' + +services: + kerberos: + image: registry.gitlab.com/altinity-qa/clickhouse/cicd/release/kerberos-arm + expose: + - "88" + - "464" + - "749" + healthcheck: + test: echo 1 + interval: 10s + timeout: 10s + retries: 3 + start_period: 300s + environment: + KRB5_PASS: pwd + KRB5_REALM: EXAMPLE.COM + KRB5_KDC: 0.0.0.0 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/kerberos/etc/krb5kdc/kdc.conf:/etc/krb5kdc/kdc.conf" + - "${CLICKHOUSE_TESTS_DIR}/_instances/kerberos/krb5kdc/log/kdc.log:/usr/local/var/krb5kdc/kdc.log" + - "${CLICKHOUSE_TESTS_DIR}/_instances/kerberos/krb5kdc/log/kadmin.log:/usr/local/var/krb5kdc/kadmin.log" + - "${CLICKHOUSE_TESTS_DIR}/_instances/kerberos/var/log:/var/log" + security_opt: + - label:disable diff --git a/tests/testflows/kerberos/kerberos_env_arm64/zookeeper-service.yml b/tests/testflows/kerberos/kerberos_env_arm64/zookeeper-service.yml new file mode 100644 index 00000000000..33cc799ab4c --- /dev/null +++ b/tests/testflows/kerberos/kerberos_env_arm64/zookeeper-service.yml @@ -0,0 +1,18 @@ +version: '2.3' + +services: + zookeeper: + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 + expose: + - "2181" + environment: + ZOO_TICK_TIME: 500 + ZOO_MY_ID: 1 + healthcheck: + test: echo stat | nc localhost 2181 + interval: 10s + timeout: 10s + retries: 3 + start_period: 300s + security_opt: + - label:disable diff --git a/tests/testflows/kerberos/regression.py b/tests/testflows/kerberos/regression.py index 0206cd3bf00..da610f89e69 100755 --- a/tests/testflows/kerberos/regression.py +++ b/tests/testflows/kerberos/regression.py @@ -2,6 +2,7 @@ import os import sys from testflows.core import * +from platform import processor as current_cpu append_path(sys.path, "..") @@ -21,24 +22,29 @@ @ArgumentParser(argparser) @Requirements(RQ_SRS_016_Kerberos("1.0")) @XFails(xfails) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """ClickHouse Kerberos authentication test regression module.""" nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), "kerberos": ("kerberos",), } + self.context.clickhouse_version = clickhouse_version + if stress is not None: self.context.stress = stress - self.context.clickhouse_version = clickhouse_version + + folder_name = os.path.basename(current_dir()) + if current_cpu() == "aarch64": + env = f"{folder_name}_env_arm64" + else: + env = f"{folder_name}_env" with Cluster( local, clickhouse_binary_path, nodes=nodes, - docker_compose_project_dir=os.path.join(current_dir(), "kerberos_env"), + docker_compose_project_dir=os.path.join(current_dir(), env), ) as cluster: self.context.cluster = cluster diff --git a/tests/testflows/kerberos/tests/common.py b/tests/testflows/kerberos/tests/common.py index 0e0f7f2ebc2..b4c6a2493f8 100644 --- a/tests/testflows/kerberos/tests/common.py +++ b/tests/testflows/kerberos/tests/common.py @@ -32,13 +32,11 @@ def create_default_config(filename): contents = "" if "kerberos_users.xml" in filename: contents = ( - "EXAMPLE.COM" - "" + "EXAMPLE.COM" + "" ) elif "kerberos.xml" in filename: - contents = ( - "EXAMPLE.COM" - ) + contents = "EXAMPLE.COM" with open(filename, "w") as f: f.write(contents) @@ -107,7 +105,7 @@ def temp_erase(self, node, filename=None): try: with Then("I overwrite file to be dummy"): with open(filename, "w") as f: - f.write("\n") + f.write("\n") node.restart() yield finally: diff --git a/tests/testflows/kerberos/tests/config.py b/tests/testflows/kerberos/tests/config.py index e682858d557..4b9609321fd 100644 --- a/tests/testflows/kerberos/tests/config.py +++ b/tests/testflows/kerberos/tests/config.py @@ -1,11 +1,12 @@ -from testflows.core import * -from kerberos.tests.common import * -from kerberos.requirements.requirements import * - +import os import time import datetime import itertools +from testflows.core import * +from kerberos.tests.common import * +from kerberos.requirements.requirements import * + @TestScenario @Requirements(RQ_SRS_016_Kerberos_Configuration_KerberosNotEnabled("1.0")) @@ -14,10 +15,12 @@ def kerberos_not_enabled(self): but Kerberos itself is not enabled in config.xml. """ ch_nodes = self.context.ch_nodes - config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml" + config_path = os.path.join( + current_dir(), "..", f"configs/{ch_nodes[0].name}/config.d/kerberos.xml" + ) def modify_file(root): - return xmltree.fromstring("") + return xmltree.fromstring("") check_wrong_config( node=ch_nodes[0], @@ -33,7 +36,9 @@ def modify_file(root): def multiple_kerberos(self): """ClickHouse SHALL disable Kerberos authentication if more than one kerberos sections specified in config.xml.""" ch_nodes = self.context.ch_nodes - config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml" + config_path = os.path.join( + current_dir(), "..", f"configs/{ch_nodes[0].name}/config.d/kerberos.xml" + ) def modify_file(root): second_section = "EXAM.COM" @@ -58,7 +63,9 @@ def wrong_user_realm(self): """ ch_nodes = self.context.ch_nodes - config_path = f"kerberos/configs/{ch_nodes[0].name}/users.d/kerberos-users.xml" + config_path = os.path.join( + current_dir(), "..", f"configs/{ch_nodes[0].name}/users.d/kerberos-users.xml" + ) def modify_file(root): krb = root.find("users").find("kerberos_user") @@ -81,7 +88,9 @@ def multiple_auth_methods(self): auth method is specified for user alongside with Kerberos. """ ch_nodes = self.context.ch_nodes - config_path = f"kerberos/configs/{ch_nodes[0].name}/users.d/kerberos-users.xml" + config_path = os.path.join( + current_dir(), "..", f"configs/{ch_nodes[0].name}/users.d/kerberos-users.xml" + ) def modify_file(root): krb = root.find("users").find("kerberos_user") @@ -103,7 +112,9 @@ def modify_file(root): def principal_and_realm_specified(self): """ClickHouse SHALL drop an exception if both realm and principal fields are specified in config.xml.""" ch_nodes = self.context.ch_nodes - config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml" + config_path = os.path.join( + current_dir(), "..", f"configs/{ch_nodes[0].name}/config.d/kerberos.xml" + ) def modify_file(root): krb = root.find("kerberos") @@ -125,7 +136,9 @@ def modify_file(root): def multiple_realm(self): """ClickHouse SHALL throw an exception and disable Kerberos if more than one realm is specified in config.xml.""" ch_nodes = self.context.ch_nodes - config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml" + config_path = os.path.join( + current_dir(), "..", f"configs/{ch_nodes[0].name}/config.d/kerberos.xml" + ) def modify_file(root): krb = root.find("kerberos") @@ -146,7 +159,9 @@ def modify_file(root): def multiple_principal(self): """ClickHouse SHALL throw an exception and disable Kerberos if more than one principal is specified in config.xml.""" ch_nodes = self.context.ch_nodes - config_path = f"kerberos/configs/{ch_nodes[0].name}/config.d/kerberos.xml" + config_path = os.path.join( + current_dir(), "..", f"configs/{ch_nodes[0].name}/config.d/kerberos.xml" + ) def modify_file(root): krb = root.find("kerberos") diff --git a/tests/testflows/ldap/authentication/authentication_env/clickhouse-service.yml b/tests/testflows/ldap/authentication/authentication_env/clickhouse-service.yml index 74661f6fa04..fe495187f5e 100644 --- a/tests/testflows/ldap/authentication/authentication_env/clickhouse-service.yml +++ b/tests/testflows/ldap/authentication/authentication_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 init: true expose: - "9000" diff --git a/tests/testflows/ldap/authentication/authentication_env/docker-compose.yml b/tests/testflows/ldap/authentication/authentication_env/docker-compose.yml index 36e25ef766e..cb4c6e69672 100644 --- a/tests/testflows/ldap/authentication/authentication_env/docker-compose.yml +++ b/tests/testflows/ldap/authentication/authentication_env/docker-compose.yml @@ -138,7 +138,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/ldap/authentication/authentication_env/openldap-service.yml b/tests/testflows/ldap/authentication/authentication_env/openldap-service.yml index 606ea3f723f..fe33082cd53 100644 --- a/tests/testflows/ldap/authentication/authentication_env/openldap-service.yml +++ b/tests/testflows/ldap/authentication/authentication_env/openldap-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: openldap: - image: osixia/openldap:1.4.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/openldap:1.4.0 command: "--copy-service --loglevel debug" environment: LDAP_ORGANIZATION: "company" @@ -22,7 +22,7 @@ services: - label:disable phpldapadmin: - image: osixia/phpldapadmin:0.9.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/phpldapadmin:0.9.0 environment: PHPLDAPADMIN_HTTPS=false: healthcheck: diff --git a/tests/testflows/ldap/authentication/authentication_env/zookeeper-service.yml b/tests/testflows/ldap/authentication/authentication_env/zookeeper-service.yml index 6691a2df31c..33cc799ab4c 100644 --- a/tests/testflows/ldap/authentication/authentication_env/zookeeper-service.yml +++ b/tests/testflows/ldap/authentication/authentication_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/ldap/authentication/authentication_env_arm64/docker-compose.yml b/tests/testflows/ldap/authentication/authentication_env_arm64/docker-compose.yml index 36e25ef766e..cb4c6e69672 100644 --- a/tests/testflows/ldap/authentication/authentication_env_arm64/docker-compose.yml +++ b/tests/testflows/ldap/authentication/authentication_env_arm64/docker-compose.yml @@ -138,7 +138,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/ldap/authentication/authentication_env_arm64/openldap-service.yml b/tests/testflows/ldap/authentication/authentication_env_arm64/openldap-service.yml index 606ea3f723f..fe33082cd53 100644 --- a/tests/testflows/ldap/authentication/authentication_env_arm64/openldap-service.yml +++ b/tests/testflows/ldap/authentication/authentication_env_arm64/openldap-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: openldap: - image: osixia/openldap:1.4.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/openldap:1.4.0 command: "--copy-service --loglevel debug" environment: LDAP_ORGANIZATION: "company" @@ -22,7 +22,7 @@ services: - label:disable phpldapadmin: - image: osixia/phpldapadmin:0.9.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/phpldapadmin:0.9.0 environment: PHPLDAPADMIN_HTTPS=false: healthcheck: diff --git a/tests/testflows/ldap/authentication/authentication_env_arm64/zookeeper-service.yml b/tests/testflows/ldap/authentication/authentication_env_arm64/zookeeper-service.yml index 6691a2df31c..33cc799ab4c 100644 --- a/tests/testflows/ldap/authentication/authentication_env_arm64/zookeeper-service.yml +++ b/tests/testflows/ldap/authentication/authentication_env_arm64/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/common.xml b/tests/testflows/ldap/authentication/configs/clickhouse/common.xml new file mode 100644 index 00000000000..df952b28c82 --- /dev/null +++ b/tests/testflows/ldap/authentication/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + 0.0.0.0 + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/logs.xml b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/logs.xml index 2ee8bb55f38..bdf1bbc11c1 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/logs.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/logs.xml @@ -1,4 +1,4 @@ - + 3 trace @@ -14,4 +14,4 @@ part_log
500 -
+ diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ports.xml b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ports.xml index 1e061e2252e..fbc6cea74c0 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ports.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ports.xml @@ -1,5 +1,5 @@ - + 8443 9440 - \ No newline at end of file + \ No newline at end of file diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/remote.xml b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/remote.xml index 04066290061..51be2a6e8e3 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/remote.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/remote.xml @@ -1,5 +1,5 @@ - + @@ -104,4 +104,4 @@ - + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ssl.xml b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ssl.xml index 77e03e9cf0f..ca65ffd5e04 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ssl.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/ssl.xml @@ -1,4 +1,4 @@ - + /etc/clickhouse-server/ssl/server.crt @@ -14,4 +14,4 @@ - + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/storage.xml b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/storage.xml index 0c53fd70593..618fd6b6d24 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/storage.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/storage.xml @@ -1,4 +1,4 @@ - + @@ -17,4 +17,4 @@ - + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/zookeeper.xml b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/zookeeper.xml index 1d5c0b6cb8b..96270e7b645 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse/config.d/zookeeper.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse/config.d/zookeeper.xml @@ -1,5 +1,5 @@ - + zookeeper @@ -7,4 +7,4 @@ 15000 - + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/config.xml b/tests/testflows/ldap/authentication/configs/clickhouse/config.xml new file mode 100644 index 00000000000..26ac36232cc --- /dev/null +++ b/tests/testflows/ldap/authentication/configs/clickhouse/config.xml @@ -0,0 +1,442 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 7200 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/ldap/authentication/configs/clickhouse/users.xml b/tests/testflows/ldap/authentication/configs/clickhouse/users.xml new file mode 100644 index 00000000000..86b2cd9e1e3 --- /dev/null +++ b/tests/testflows/ldap/authentication/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse1/config.d/macros.xml b/tests/testflows/ldap/authentication/configs/clickhouse1/config.d/macros.xml index c59a85cad8f..6cdcc1b440c 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse1/config.d/macros.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse1/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse1 01 01 - + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse2/config.d/macros.xml b/tests/testflows/ldap/authentication/configs/clickhouse2/config.d/macros.xml index 1f880da0f65..a114a9ce4ab 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse2/config.d/macros.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse2/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse2 01 02 - + diff --git a/tests/testflows/ldap/authentication/configs/clickhouse3/config.d/macros.xml b/tests/testflows/ldap/authentication/configs/clickhouse3/config.d/macros.xml index d2f1dbafa04..904a27b0172 100644 --- a/tests/testflows/ldap/authentication/configs/clickhouse3/config.d/macros.xml +++ b/tests/testflows/ldap/authentication/configs/clickhouse3/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse3 01 03 - + diff --git a/tests/testflows/ldap/authentication/ldap_authentication_env/clickhouse-service.yml b/tests/testflows/ldap/authentication/ldap_authentication_env/clickhouse-service.yml index 0c9352dbc0b..74a56b63aab 100644 --- a/tests/testflows/ldap/authentication/ldap_authentication_env/clickhouse-service.yml +++ b/tests/testflows/ldap/authentication/ldap_authentication_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: altinityinfra/integration-test expose: - "9000" - "9009" diff --git a/tests/testflows/ldap/authentication/regression.py b/tests/testflows/ldap/authentication/regression.py index d2e541598ea..1f6343ac334 100755 --- a/tests/testflows/ldap/authentication/regression.py +++ b/tests/testflows/ldap/authentication/regression.py @@ -42,9 +42,7 @@ @Specifications(SRS_007_ClickHouse_Authentication_of_Users_via_LDAP) @Requirements(RQ_SRS_007_LDAP_Authentication("1.0")) @XFails(xfails) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """ClickHouse integration with LDAP regression module.""" nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), diff --git a/tests/testflows/ldap/authentication/requirements/requirements.md b/tests/testflows/ldap/authentication/requirements/requirements.md index a42e2eaa132..372c44e20c5 100644 --- a/tests/testflows/ldap/authentication/requirements/requirements.md +++ b/tests/testflows/ldap/authentication/requirements/requirements.md @@ -442,7 +442,7 @@ version: 2.0 configuration file or of any configuration file inside the `config.d` directory. ```xml - + localhost 636 @@ -458,7 +458,7 @@ configuration file or of any configuration file inside the `config.d` directory. /path/to/tls_ca_cert_dir ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384 - + ``` #### RQ.SRS-007.LDAP.Configuration.User.RBAC @@ -478,7 +478,7 @@ version: 1.0 an [LDAP] server inside the `users.xml` file or any configuration file inside the `users.d` directory. ```xml - + @@ -486,7 +486,7 @@ an [LDAP] server inside the `users.xml` file or any configuration file inside th - + ``` #### RQ.SRS-007.LDAP.Configuration.User.Name.Empty diff --git a/tests/testflows/ldap/authentication/requirements/requirements.py b/tests/testflows/ldap/authentication/requirements/requirements.py index 6ee904bd40e..fe8b2d5d60c 100644 --- a/tests/testflows/ldap/authentication/requirements/requirements.py +++ b/tests/testflows/ldap/authentication/requirements/requirements.py @@ -917,7 +917,7 @@ "configuration file or of any configuration file inside the `config.d` directory.\n" "\n" "```xml\n" - "\n" + "\n" " \n" " localhost\n" " 636\n" @@ -933,7 +933,7 @@ " /path/to/tls_ca_cert_dir\n" " ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384\n" " \n" - "\n" + "\n" "```\n" "\n" ), @@ -975,7 +975,7 @@ "an [LDAP] server inside the `users.xml` file or any configuration file inside the `users.d` directory.\n" "\n" "```xml\n" - "\n" + "\n" " \n" " \n" " \n" @@ -983,7 +983,7 @@ " \n" " \n" " \n" - "\n" + "\n" "```\n" "\n" ), @@ -2092,7 +2092,7 @@ configuration file or of any configuration file inside the `config.d` directory. ```xml - + localhost 636 @@ -2108,7 +2108,7 @@ /path/to/tls_ca_cert_dir ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384 - + ``` #### RQ.SRS-007.LDAP.Configuration.User.RBAC @@ -2128,7 +2128,7 @@ an [LDAP] server inside the `users.xml` file or any configuration file inside the `users.d` directory. ```xml - + @@ -2136,7 +2136,7 @@ - + ``` #### RQ.SRS-007.LDAP.Configuration.User.Name.Empty diff --git a/tests/testflows/ldap/authentication/tests/authentications.py b/tests/testflows/ldap/authentication/tests/authentications.py index 8f98adce746..bdfa03ff453 100644 --- a/tests/testflows/ldap/authentication/tests/authentications.py +++ b/tests/testflows/ldap/authentication/tests/authentications.py @@ -900,7 +900,7 @@ def repeat_requests(self, server, iterations, vcd_value, rbac=False, timeout=600 @TestScenario @Tags("verification_cooldown") @Requirements(RQ_SRS_007_LDAP_Authentication_VerificationCooldown_Performance("1.0")) -def verification_cooldown_performance(self, server, rbac=False, iterations=5000): +def verification_cooldown_performance(self, server, rbac=False, iterations=500): """Check that login performance is better when the verification cooldown parameter is set to a positive value when comparing to the case when the verification cooldown parameter is turned off. diff --git a/tests/testflows/ldap/authentication/tests/common.py b/tests/testflows/ldap/authentication/tests/common.py index 17b4fcd3e62..d35d2c7a85f 100644 --- a/tests/testflows/ldap/authentication/tests/common.py +++ b/tests/testflows/ldap/authentication/tests/common.py @@ -80,7 +80,7 @@ def create_ldap_servers_config_content( path = os.path.join(config_d_dir, config_file) name = config_file - root = xmltree.fromstring("") + root = xmltree.fromstring("") xml_servers = root.find("ldap_servers") xml_servers.append(xmltree.Comment(text=f"LDAP servers {uid}")) @@ -128,7 +128,7 @@ def create_ldap_users_config_content( path = os.path.join(config_d_dir, config_file) name = config_file - root = xmltree.fromstring("") + root = xmltree.fromstring("") xml_users = root.find("users") xml_users.append(xmltree.Comment(text=f"LDAP users {uid}")) diff --git a/tests/testflows/ldap/authentication/tests/server_config.py b/tests/testflows/ldap/authentication/tests/server_config.py index af15a1495df..af817ee147a 100644 --- a/tests/testflows/ldap/authentication/tests/server_config.py +++ b/tests/testflows/ldap/authentication/tests/server_config.py @@ -358,7 +358,7 @@ def invalid_verification_cooldown_value(self, invalid_value, timeout=300): def syntax(self): """Check that server configuration with valid syntax can be loaded. ```xml - + localhost 636 @@ -374,7 +374,7 @@ def syntax(self): /path/to/tls_ca_cert_dir ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384 - + ``` """ servers = { diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/common.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/common.xml new file mode 100644 index 00000000000..df952b28c82 --- /dev/null +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + 0.0.0.0 + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/logs.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/logs.xml index 2ee8bb55f38..bdf1bbc11c1 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/logs.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/logs.xml @@ -1,4 +1,4 @@ - + 3 trace @@ -14,4 +14,4 @@ part_log
500 -
+ diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ports.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ports.xml index 1e061e2252e..fbc6cea74c0 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ports.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ports.xml @@ -1,5 +1,5 @@ - + 8443 9440 - \ No newline at end of file + \ No newline at end of file diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/remote.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/remote.xml index 04066290061..51be2a6e8e3 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/remote.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/remote.xml @@ -1,5 +1,5 @@ - + @@ -104,4 +104,4 @@ - + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ssl.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ssl.xml index 77e03e9cf0f..ca65ffd5e04 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ssl.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/ssl.xml @@ -1,4 +1,4 @@ - + /etc/clickhouse-server/ssl/server.crt @@ -14,4 +14,4 @@ - + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/storage.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/storage.xml index 0c53fd70593..618fd6b6d24 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/storage.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/storage.xml @@ -1,4 +1,4 @@ - + @@ -17,4 +17,4 @@ - + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/zookeeper.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/zookeeper.xml index 1d5c0b6cb8b..96270e7b645 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/zookeeper.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.d/zookeeper.xml @@ -1,5 +1,5 @@ - + zookeeper @@ -7,4 +7,4 @@ 15000 - + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.xml new file mode 100644 index 00000000000..26ac36232cc --- /dev/null +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/config.xml @@ -0,0 +1,442 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 7200 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse/users.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse/users.xml new file mode 100644 index 00000000000..86b2cd9e1e3 --- /dev/null +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse1/config.d/macros.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse1/config.d/macros.xml index c59a85cad8f..6cdcc1b440c 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse1/config.d/macros.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse1/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse1 01 01 - + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse2/config.d/macros.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse2/config.d/macros.xml index 1f880da0f65..a114a9ce4ab 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse2/config.d/macros.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse2/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse2 01 02 - + diff --git a/tests/testflows/ldap/external_user_directory/configs/clickhouse3/config.d/macros.xml b/tests/testflows/ldap/external_user_directory/configs/clickhouse3/config.d/macros.xml index d2f1dbafa04..904a27b0172 100644 --- a/tests/testflows/ldap/external_user_directory/configs/clickhouse3/config.d/macros.xml +++ b/tests/testflows/ldap/external_user_directory/configs/clickhouse3/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse3 01 03 - + diff --git a/tests/testflows/ldap/external_user_directory/external_user_directory_env/clickhouse-service.yml b/tests/testflows/ldap/external_user_directory/external_user_directory_env/clickhouse-service.yml index 74661f6fa04..fe495187f5e 100644 --- a/tests/testflows/ldap/external_user_directory/external_user_directory_env/clickhouse-service.yml +++ b/tests/testflows/ldap/external_user_directory/external_user_directory_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 init: true expose: - "9000" diff --git a/tests/testflows/ldap/external_user_directory/external_user_directory_env/docker-compose.yml b/tests/testflows/ldap/external_user_directory/external_user_directory_env/docker-compose.yml index 36e25ef766e..cb4c6e69672 100644 --- a/tests/testflows/ldap/external_user_directory/external_user_directory_env/docker-compose.yml +++ b/tests/testflows/ldap/external_user_directory/external_user_directory_env/docker-compose.yml @@ -138,7 +138,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/ldap/external_user_directory/external_user_directory_env/openldap-service.yml b/tests/testflows/ldap/external_user_directory/external_user_directory_env/openldap-service.yml index 606ea3f723f..fe33082cd53 100644 --- a/tests/testflows/ldap/external_user_directory/external_user_directory_env/openldap-service.yml +++ b/tests/testflows/ldap/external_user_directory/external_user_directory_env/openldap-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: openldap: - image: osixia/openldap:1.4.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/openldap:1.4.0 command: "--copy-service --loglevel debug" environment: LDAP_ORGANIZATION: "company" @@ -22,7 +22,7 @@ services: - label:disable phpldapadmin: - image: osixia/phpldapadmin:0.9.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/phpldapadmin:0.9.0 environment: PHPLDAPADMIN_HTTPS=false: healthcheck: diff --git a/tests/testflows/ldap/external_user_directory/external_user_directory_env/zookeeper-service.yml b/tests/testflows/ldap/external_user_directory/external_user_directory_env/zookeeper-service.yml index 6691a2df31c..33cc799ab4c 100644 --- a/tests/testflows/ldap/external_user_directory/external_user_directory_env/zookeeper-service.yml +++ b/tests/testflows/ldap/external_user_directory/external_user_directory_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/docker-compose.yml b/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/docker-compose.yml index 36e25ef766e..cb4c6e69672 100644 --- a/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/docker-compose.yml +++ b/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/docker-compose.yml @@ -138,7 +138,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/openldap-service.yml b/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/openldap-service.yml index 606ea3f723f..fe33082cd53 100644 --- a/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/openldap-service.yml +++ b/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/openldap-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: openldap: - image: osixia/openldap:1.4.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/openldap:1.4.0 command: "--copy-service --loglevel debug" environment: LDAP_ORGANIZATION: "company" @@ -22,7 +22,7 @@ services: - label:disable phpldapadmin: - image: osixia/phpldapadmin:0.9.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/phpldapadmin:0.9.0 environment: PHPLDAPADMIN_HTTPS=false: healthcheck: diff --git a/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/zookeeper-service.yml b/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/zookeeper-service.yml index 6691a2df31c..33cc799ab4c 100644 --- a/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/zookeeper-service.yml +++ b/tests/testflows/ldap/external_user_directory/external_user_directory_env_arm64/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/ldap/external_user_directory/ldap_external_user_directory_env/clickhouse-service.yml b/tests/testflows/ldap/external_user_directory/ldap_external_user_directory_env/clickhouse-service.yml index 0c9352dbc0b..74a56b63aab 100644 --- a/tests/testflows/ldap/external_user_directory/ldap_external_user_directory_env/clickhouse-service.yml +++ b/tests/testflows/ldap/external_user_directory/ldap_external_user_directory_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: altinityinfra/integration-test expose: - "9000" - "9009" diff --git a/tests/testflows/ldap/external_user_directory/regression.py b/tests/testflows/ldap/external_user_directory/regression.py index de53bf9128e..da2be345759 100755 --- a/tests/testflows/ldap/external_user_directory/regression.py +++ b/tests/testflows/ldap/external_user_directory/regression.py @@ -55,9 +55,7 @@ @Requirements(RQ_SRS_009_LDAP_ExternalUserDirectory_Authentication("1.0")) @XFails(xfails) @FFails(ffails) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """ClickHouse LDAP external user directory regression module.""" nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), diff --git a/tests/testflows/ldap/external_user_directory/requirements/requirements.md b/tests/testflows/ldap/external_user_directory/requirements/requirements.md index 44c9bdf4c67..8159df710bb 100644 --- a/tests/testflows/ldap/external_user_directory/requirements/requirements.md +++ b/tests/testflows/ldap/external_user_directory/requirements/requirements.md @@ -611,7 +611,7 @@ version: 2.0 configuration file or of any configuration file inside the `config.d` directory. ```xml - + localhost 636 @@ -627,7 +627,7 @@ configuration file or of any configuration file inside the `config.d` directory. /path/to/tls_ca_cert_dir ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384 - + ``` ##### RQ.SRS-009.LDAP.ExternalUserDirectory.Configuration.Users.LDAPUserDirectory @@ -649,7 +649,7 @@ version: 1.0 [ClickHouse] SHALL support `` section with the following syntax ```xml - + my_ldap_server @@ -659,7 +659,7 @@ version: 1.0 - + ``` ##### RQ.SRS-009.LDAP.ExternalUserDirectory.Configuration.Users.Parameters.Server diff --git a/tests/testflows/ldap/external_user_directory/requirements/requirements.py b/tests/testflows/ldap/external_user_directory/requirements/requirements.py index e15cc7a034e..8fdee3be16b 100644 --- a/tests/testflows/ldap/external_user_directory/requirements/requirements.py +++ b/tests/testflows/ldap/external_user_directory/requirements/requirements.py @@ -1234,7 +1234,7 @@ "configuration file or of any configuration file inside the `config.d` directory.\n" "\n" "```xml\n" - "\n" + "\n" " \n" " localhost\n" " 636\n" @@ -1250,7 +1250,7 @@ " /path/to/tls_ca_cert_dir\n" " ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384\n" " \n" - "\n" + "\n" "```\n" "\n" ), @@ -1305,7 +1305,7 @@ "[ClickHouse] SHALL support `` section with the following syntax\n" "\n" "```xml\n" - "\n" + "\n" " \n" " \n" " my_ldap_server\n" @@ -1315,7 +1315,7 @@ " \n" " \n" " \n" - "\n" + "\n" "```\n" "\n" ), @@ -2862,7 +2862,7 @@ configuration file or of any configuration file inside the `config.d` directory. ```xml - + localhost 636 @@ -2878,7 +2878,7 @@ /path/to/tls_ca_cert_dir ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384 - + ``` ##### RQ.SRS-009.LDAP.ExternalUserDirectory.Configuration.Users.LDAPUserDirectory @@ -2900,7 +2900,7 @@ [ClickHouse] SHALL support `` section with the following syntax ```xml - + my_ldap_server @@ -2910,7 +2910,7 @@ - + ``` ##### RQ.SRS-009.LDAP.ExternalUserDirectory.Configuration.Users.Parameters.Server diff --git a/tests/testflows/ldap/external_user_directory/tests/authentications.py b/tests/testflows/ldap/external_user_directory/tests/authentications.py index 83daa175a24..e2d77c9a1b1 100644 --- a/tests/testflows/ldap/external_user_directory/tests/authentications.py +++ b/tests/testflows/ldap/external_user_directory/tests/authentications.py @@ -1274,7 +1274,7 @@ def repeat_requests(self, server, iterations, vcd_value, rbac=False): "1.0" ) ) -def verification_cooldown_performance(self, server, rbac=False, iterations=5000): +def verification_cooldown_performance(self, server, rbac=False, iterations=500): """Check login performance when the verification cooldown parameter is set to a positive value when comparing to the case when the verification cooldown parameter is turned off. diff --git a/tests/testflows/ldap/external_user_directory/tests/common.py b/tests/testflows/ldap/external_user_directory/tests/common.py index 871be815a35..348abed002f 100644 --- a/tests/testflows/ldap/external_user_directory/tests/common.py +++ b/tests/testflows/ldap/external_user_directory/tests/common.py @@ -129,9 +129,7 @@ def create_entries_ldap_external_user_directory_config_content( path = os.path.join(config_d_dir, config_file) name = config_file - root = xmltree.fromstring( - "" - ) + root = xmltree.fromstring("") xml_user_directories = root.find("user_directories") xml_user_directories.append( xmltree.Comment(text=f"LDAP external user directories {uid}") diff --git a/tests/testflows/ldap/external_user_directory/tests/server_config.py b/tests/testflows/ldap/external_user_directory/tests/server_config.py index a26713e28cf..0e6b454fd1c 100644 --- a/tests/testflows/ldap/external_user_directory/tests/server_config.py +++ b/tests/testflows/ldap/external_user_directory/tests/server_config.py @@ -392,7 +392,7 @@ def invalid_verification_cooldown_value(self, invalid_value, timeout=300): def syntax(self): """Check that server configuration with valid syntax can be loaded. ```xml - + localhost 636 @@ -408,7 +408,7 @@ def syntax(self): /path/to/tls_ca_cert_dir ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:AES256-GCM-SHA384 - + ``` """ servers = { diff --git a/tests/testflows/ldap/regression.py b/tests/testflows/ldap/regression.py index 5b3ea30ef73..661410dc44a 100755 --- a/tests/testflows/ldap/regression.py +++ b/tests/testflows/ldap/regression.py @@ -10,9 +10,7 @@ @TestModule @Name("ldap") @ArgumentParser(argparser) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """ClickHouse LDAP integration regression module.""" args = { "local": local, diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/common.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/common.xml new file mode 100644 index 00000000000..df952b28c82 --- /dev/null +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + 0.0.0.0 + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/logs.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/logs.xml index 2ee8bb55f38..bdf1bbc11c1 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/logs.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/logs.xml @@ -1,4 +1,4 @@ - + 3 trace @@ -14,4 +14,4 @@ part_log
500 -
+ diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ports.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ports.xml index 1e061e2252e..fbc6cea74c0 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ports.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ports.xml @@ -1,5 +1,5 @@ - + 8443 9440 - \ No newline at end of file + \ No newline at end of file diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/remote.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/remote.xml index 04066290061..51be2a6e8e3 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/remote.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/remote.xml @@ -1,5 +1,5 @@ - + @@ -104,4 +104,4 @@ - + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ssl.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ssl.xml index c90b60f98b6..16d82440b89 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ssl.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/ssl.xml @@ -1,4 +1,4 @@ - + /etc/clickhouse-server/ssl/server.crt @@ -15,4 +15,4 @@ - + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/storage.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/storage.xml index 0c53fd70593..618fd6b6d24 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/storage.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/storage.xml @@ -1,4 +1,4 @@ - + @@ -17,4 +17,4 @@ - + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/zookeeper.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/zookeeper.xml index 1d5c0b6cb8b..96270e7b645 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/zookeeper.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.d/zookeeper.xml @@ -1,5 +1,5 @@ - + zookeeper @@ -7,4 +7,4 @@ 15000 - + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/config.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.xml new file mode 100644 index 00000000000..26ac36232cc --- /dev/null +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/config.xml @@ -0,0 +1,442 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 7200 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/users.d/common.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/users.d/common.xml index f6e0553ca33..1b1a3a4a5ac 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse/users.d/common.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/users.d/common.xml @@ -1,4 +1,4 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse/users.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse/users.xml new file mode 100644 index 00000000000..86b2cd9e1e3 --- /dev/null +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse1/config.d/macros.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse1/config.d/macros.xml index c59a85cad8f..6cdcc1b440c 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse1/config.d/macros.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse1/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse1 01 01 - + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse2/config.d/macros.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse2/config.d/macros.xml index 1f880da0f65..a114a9ce4ab 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse2/config.d/macros.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse2/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse2 01 02 - + diff --git a/tests/testflows/ldap/role_mapping/configs/clickhouse3/config.d/macros.xml b/tests/testflows/ldap/role_mapping/configs/clickhouse3/config.d/macros.xml index d2f1dbafa04..904a27b0172 100644 --- a/tests/testflows/ldap/role_mapping/configs/clickhouse3/config.d/macros.xml +++ b/tests/testflows/ldap/role_mapping/configs/clickhouse3/config.d/macros.xml @@ -1,8 +1,8 @@ - + clickhouse3 01 03 - + diff --git a/tests/testflows/ldap/role_mapping/ldap_role_mapping_env/clickhouse-service.yml b/tests/testflows/ldap/role_mapping/ldap_role_mapping_env/clickhouse-service.yml index 0c9352dbc0b..74a56b63aab 100644 --- a/tests/testflows/ldap/role_mapping/ldap_role_mapping_env/clickhouse-service.yml +++ b/tests/testflows/ldap/role_mapping/ldap_role_mapping_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: altinityinfra/integration-test expose: - "9000" - "9009" diff --git a/tests/testflows/ldap/role_mapping/regression.py b/tests/testflows/ldap/role_mapping/regression.py index fc2b85dba6f..cdca1e61f43 100755 --- a/tests/testflows/ldap/role_mapping/regression.py +++ b/tests/testflows/ldap/role_mapping/regression.py @@ -38,9 +38,7 @@ @Requirements(RQ_SRS_014_LDAP_RoleMapping("1.0")) @XFails(xfails) @FFails(ffails) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """ClickHouse LDAP role mapping regression module.""" nodes = { "clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3"), diff --git a/tests/testflows/ldap/role_mapping/requirements/requirements.md b/tests/testflows/ldap/role_mapping/requirements/requirements.md index a9414749be3..75fa4feffff 100644 --- a/tests/testflows/ldap/role_mapping/requirements/requirements.md +++ b/tests/testflows/ldap/role_mapping/requirements/requirements.md @@ -308,7 +308,7 @@ with the actual user name during each authentication attempt. For example, ```xml - + @@ -316,7 +316,7 @@ For example, - + ``` ##### RQ.SRS-014.LDAP.RoleMapping.Configuration.Server.BindDN.ConflictWith.AuthDN @@ -399,7 +399,7 @@ of the `config.xml`. For example, ```xml - + @@ -412,7 +412,7 @@ For example, - + ``` #### Special Characters Escaping @@ -563,7 +563,7 @@ cluster is configured with and without ``. For example, ```xml - + qwerty123 @@ -583,13 +583,13 @@ For example, - + ``` or ```xml - + @@ -608,7 +608,7 @@ or - + ``` ## References diff --git a/tests/testflows/ldap/role_mapping/requirements/requirements.py b/tests/testflows/ldap/role_mapping/requirements/requirements.py index e63e8593e99..dc1790f09b3 100644 --- a/tests/testflows/ldap/role_mapping/requirements/requirements.py +++ b/tests/testflows/ldap/role_mapping/requirements/requirements.py @@ -482,7 +482,7 @@ "For example, \n" "\n" "```xml\n" - "\n" + "\n" " \n" " \n" " \n" @@ -490,7 +490,7 @@ " \n" " \n" " \n" - "\n" + "\n" "```\n" "\n" ), @@ -633,7 +633,7 @@ "For example,\n" "\n" "```xml\n" - "\n" + "\n" " \n" " \n" " \n" @@ -646,7 +646,7 @@ " \n" " \n" " \n" - "\n" + "\n" "```\n" "\n" ), @@ -979,7 +979,7 @@ "For example,\n" "\n" "```xml\n" - "\n" + "\n" " \n" " \n" " qwerty123\n" @@ -999,13 +999,13 @@ " \n" " \n" " \n" - "\n" + "\n" "```\n" "\n" "or \n" "\n" "```xml\n" - "\n" + "\n" " \n" " \n" " \n" @@ -1024,7 +1024,7 @@ " \n" " \n" " \n" - "\n" + "\n" "```\n" "\n" ), @@ -1669,7 +1669,7 @@ For example, ```xml - + @@ -1677,7 +1677,7 @@ - + ``` ##### RQ.SRS-014.LDAP.RoleMapping.Configuration.Server.BindDN.ConflictWith.AuthDN @@ -1760,7 +1760,7 @@ For example, ```xml - + @@ -1773,7 +1773,7 @@ - + ``` #### Special Characters Escaping @@ -1924,7 +1924,7 @@ For example, ```xml - + qwerty123 @@ -1944,13 +1944,13 @@ - + ``` or ```xml - + @@ -1969,7 +1969,7 @@ - + ``` ## References diff --git a/tests/testflows/ldap/role_mapping/role_mapping_env/clickhouse-service.yml b/tests/testflows/ldap/role_mapping/role_mapping_env/clickhouse-service.yml index 7ff0139ab9b..1875e0659f4 100644 --- a/tests/testflows/ldap/role_mapping/role_mapping_env/clickhouse-service.yml +++ b/tests/testflows/ldap/role_mapping/role_mapping_env/clickhouse-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 init: true expose: - "9000" diff --git a/tests/testflows/ldap/role_mapping/role_mapping_env/docker-compose.yml b/tests/testflows/ldap/role_mapping/role_mapping_env/docker-compose.yml index 624a5a18498..284273ca47d 100644 --- a/tests/testflows/ldap/role_mapping/role_mapping_env/docker-compose.yml +++ b/tests/testflows/ldap/role_mapping/role_mapping_env/docker-compose.yml @@ -135,7 +135,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/ldap/role_mapping/role_mapping_env/openldap-service.yml b/tests/testflows/ldap/role_mapping/role_mapping_env/openldap-service.yml index 606ea3f723f..fe33082cd53 100644 --- a/tests/testflows/ldap/role_mapping/role_mapping_env/openldap-service.yml +++ b/tests/testflows/ldap/role_mapping/role_mapping_env/openldap-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: openldap: - image: osixia/openldap:1.4.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/openldap:1.4.0 command: "--copy-service --loglevel debug" environment: LDAP_ORGANIZATION: "company" @@ -22,7 +22,7 @@ services: - label:disable phpldapadmin: - image: osixia/phpldapadmin:0.9.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/phpldapadmin:0.9.0 environment: PHPLDAPADMIN_HTTPS=false: healthcheck: diff --git a/tests/testflows/ldap/role_mapping/role_mapping_env/zookeeper-service.yml b/tests/testflows/ldap/role_mapping/role_mapping_env/zookeeper-service.yml index 6691a2df31c..33cc799ab4c 100644 --- a/tests/testflows/ldap/role_mapping/role_mapping_env/zookeeper-service.yml +++ b/tests/testflows/ldap/role_mapping/role_mapping_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/docker-compose.yml b/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/docker-compose.yml index 624a5a18498..284273ca47d 100644 --- a/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/docker-compose.yml +++ b/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/docker-compose.yml @@ -135,7 +135,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/openldap-service.yml b/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/openldap-service.yml index 606ea3f723f..fe33082cd53 100644 --- a/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/openldap-service.yml +++ b/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/openldap-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: openldap: - image: osixia/openldap:1.4.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/openldap:1.4.0 command: "--copy-service --loglevel debug" environment: LDAP_ORGANIZATION: "company" @@ -22,7 +22,7 @@ services: - label:disable phpldapadmin: - image: osixia/phpldapadmin:0.9.0 + image: ${IMAGE_DEPENDENCY_PROXY}osixia/phpldapadmin:0.9.0 environment: PHPLDAPADMIN_HTTPS=false: healthcheck: diff --git a/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/zookeeper-service.yml b/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/zookeeper-service.yml index 6691a2df31c..33cc799ab4c 100644 --- a/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/zookeeper-service.yml +++ b/tests/testflows/ldap/role_mapping/role_mapping_env_arm64/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/map_type/configs/clickhouse/config.d/macros.xml b/tests/testflows/map_type/configs/clickhouse/config.d/macros.xml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/testflows/map_type/configs/clickhouse/config.xml b/tests/testflows/map_type/configs/clickhouse/config.xml new file mode 100644 index 00000000000..842a0573d49 --- /dev/null +++ b/tests/testflows/map_type/configs/clickhouse/config.xml @@ -0,0 +1,448 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + 0.0.0.0 + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + /var/lib/clickhouse/access/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + users.xml + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/map_type/configs/clickhouse/users.xml b/tests/testflows/map_type/configs/clickhouse/users.xml new file mode 100644 index 00000000000..c7d0ecae693 --- /dev/null +++ b/tests/testflows/map_type/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/map_type/map_type_env/clickhouse-service.yml b/tests/testflows/map_type/map_type_env/clickhouse-service.yml index afb31f77c94..4d5f827ee30 100755 --- a/tests/testflows/map_type/map_type_env/clickhouse-service.yml +++ b/tests/testflows/map_type/map_type_env/clickhouse-service.yml @@ -2,21 +2,24 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 + init: true expose: - "9000" - "9009" - "8123" volumes: - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" - entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + entrypoint: bash -c "tail -f /dev/null" healthcheck: - test: clickhouse client --query='select 1' + test: echo 1 interval: 10s timeout: 10s retries: 3 diff --git a/tests/testflows/map_type/map_type_env/docker-compose.yml b/tests/testflows/map_type/map_type_env/docker-compose.yml index 29f2ef52470..c9ae33d7884 100755 --- a/tests/testflows/map_type/map_type_env/docker-compose.yml +++ b/tests/testflows/map_type/map_type_env/docker-compose.yml @@ -48,7 +48,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/map_type/map_type_env/zookeeper-service.yml b/tests/testflows/map_type/map_type_env/zookeeper-service.yml index f3df33358be..60c0e4e7de3 100755 --- a/tests/testflows/map_type/map_type_env/zookeeper-service.yml +++ b/tests/testflows/map_type/map_type_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/map_type/map_type_env_arm64/clickhouse-service.yml b/tests/testflows/map_type/map_type_env_arm64/clickhouse-service.yml new file mode 100755 index 00000000000..6de5d62e6c0 --- /dev/null +++ b/tests/testflows/map_type/map_type_env_arm64/clickhouse-service.yml @@ -0,0 +1,30 @@ +version: '2.3' + +services: + clickhouse: + image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:21.12 + privileged: true + expose: + - "9000" + - "9009" + - "8123" + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" + - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" + entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + healthcheck: + test: clickhouse client --query='select 1' + interval: 10s + timeout: 10s + retries: 3 + start_period: 300s + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/tests/testflows/map_type/map_type_env_arm64/docker-compose.yml b/tests/testflows/map_type/map_type_env_arm64/docker-compose.yml new file mode 100755 index 00000000000..c9ae33d7884 --- /dev/null +++ b/tests/testflows/map_type/map_type_env_arm64/docker-compose.yml @@ -0,0 +1,60 @@ +version: '2.3' + +services: + zookeeper: + extends: + file: zookeeper-service.yml + service: zookeeper + + clickhouse1: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse2: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse2 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse3: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse3 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + depends_on: + zookeeper: + condition: service_healthy + + # dummy service which does nothing, but allows to postpone + # 'docker-compose up -d' till all dependecies will go healthy + all_services_ready: + image: ${IMAGE_DEPENDENCY_PROXY}hello-world + depends_on: + clickhouse1: + condition: service_healthy + clickhouse2: + condition: service_healthy + clickhouse3: + condition: service_healthy + zookeeper: + condition: service_healthy diff --git a/tests/testflows/map_type/map_type_env_arm64/zookeeper-service.yml b/tests/testflows/map_type/map_type_env_arm64/zookeeper-service.yml new file mode 100755 index 00000000000..60c0e4e7de3 --- /dev/null +++ b/tests/testflows/map_type/map_type_env_arm64/zookeeper-service.yml @@ -0,0 +1,18 @@ +version: '2.3' + +services: + zookeeper: + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 + expose: + - "2181" + environment: + ZOO_TICK_TIME: 500 + ZOO_MY_ID: 1 + healthcheck: + test: echo stat | nc localhost 2181 + interval: 3s + timeout: 2s + retries: 5 + start_period: 2s + security_opt: + - label:disable diff --git a/tests/testflows/map_type/regression.py b/tests/testflows/map_type/regression.py index 321a6944b2b..3821da7d2f7 100755 --- a/tests/testflows/map_type/regression.py +++ b/tests/testflows/map_type/regression.py @@ -8,6 +8,7 @@ from helpers.cluster import Cluster from helpers.argparser import argparser +from helpers.common import check_clickhouse_version from map_type.requirements import SRS018_ClickHouse_Map_Data_Type xfails = { @@ -136,32 +137,59 @@ "tests/table map with value integer/UInt64": [ (Fail, "new bug due to JSON changes") ], + "tests/:/:": [(Fail, "debug")], } xflags = {} +ffails = { + "/clickhouse/map type/tests/table map unsupported types/nullable map": ( + XFail, + "type supported in 21.12", + (lambda test: check_clickhouse_version(">=21.12")(test)), + ), + "/clickhouse/map type/tests/table map unsupported types/map with nothing type for key and value": ( + XFail, + "type supported in 21.12", + (lambda test: check_clickhouse_version(">=21.12")(test)), + ), + "/clickhouse/map type/tests/table map invalid key/integer when key is string": ( + XFail, + "type supported in 21.12", + (lambda test: check_clickhouse_version(">=21.12")(test)), + ), +} + @TestModule @ArgumentParser(argparser) @XFails(xfails) @XFlags(xflags) +@FFails(ffails) @Name("map type") @Specifications(SRS018_ClickHouse_Map_Data_Type) -def regression( - self, local, clickhouse_binary_path, clickhouser_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """Map type regression.""" nodes = {"clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3")} + self.context.clickhouse_version = clickhouse_version + if stress is not None: self.context.stress = stress - self.context.clickhouse_version = clickhouse_version + + from platform import processor as current_cpu + + folder_name = os.path.basename(current_dir()) + if current_cpu() == "aarch64": + env = f"{folder_name}_env_arm64" + else: + env = f"{folder_name}_env" with Cluster( local, clickhouse_binary_path, nodes=nodes, - docker_compose_project_dir=os.path.join(current_dir(), "map_type_env"), + docker_compose_project_dir=os.path.join(current_dir(), env), ) as cluster: self.context.cluster = cluster diff --git a/tests/testflows/map_type/tests/feature.py b/tests/testflows/map_type/tests/feature.py index 0aee235c1ed..e3b4f253c98 100755 --- a/tests/testflows/map_type/tests/feature.py +++ b/tests/testflows/map_type/tests/feature.py @@ -6,6 +6,7 @@ from map_type.requirements import * from map_type.tests.common import * +from helpers.common import check_clickhouse_version @TestOutline @@ -1241,19 +1242,18 @@ def invalid_key(self): """Check when key is not valid.""" node = self.context.node + exitcode = 43 if check_clickhouse_version("<21.12")(self) else 0 + message = ( + "DB::Exception: Illegal types of arguments" + if check_clickhouse_version("<21.12")(self) + else "" + ) + with When("I try to use an integer key that is too large"): - node.query( - "SELECT map(1,2) AS m, m[256]", - exitcode=43, - message="DB::Exception: Illegal types of arguments", - ) + node.query("SELECT map(1,2) AS m, m[256]", exitcode=exitcode, message=message) with When("I try to use an integer key that is negative when key is unsigned"): - node.query( - "SELECT map(1,2) AS m, m[-1]", - exitcode=43, - message="DB::Exception: Illegal types of arguments", - ) + node.query("SELECT map(1,2) AS m, m[-1]", exitcode=exitcode, message=message) with When("I try to use a string key when key is an integer"): node.query( @@ -1278,18 +1278,14 @@ def invalid_key(self): with When("I try to use wrong type conversion in key"): r = node.query( - "SELECT map(1,2) AS m, m[toInt8('1')]", - exitcode=43, - message="DB::Exception: Illegal types of arguments", + "SELECT map(1,2) AS m, m[toInt8('1')]", exitcode=exitcode, message=message ) with When( "in array of maps I try to use an integer key that is negative when key is unsigned" ): node.query( - "SELECT [map(1,2)] AS m, m[1][-1]", - exitcode=43, - message="DB::Exception: Illegal types of arguments", + "SELECT [map(1,2)] AS m, m[1][-1]", exitcode=exitcode, message=message ) with When("I try to use a NULL key when key is not nullable"): diff --git a/tests/testflows/rbac/configs/clickhouse/common.xml b/tests/testflows/rbac/configs/clickhouse/common.xml new file mode 100644 index 00000000000..0ba01589b90 --- /dev/null +++ b/tests/testflows/rbac/configs/clickhouse/common.xml @@ -0,0 +1,6 @@ + + Europe/Moscow + :: + /var/lib/clickhouse/ + /var/lib/clickhouse/tmp/ + diff --git a/tests/testflows/rbac/configs/clickhouse/config.d/ports.xml b/tests/testflows/rbac/configs/clickhouse/config.d/ports.xml index 1e061e2252e..01ce4adf52d 100644 --- a/tests/testflows/rbac/configs/clickhouse/config.d/ports.xml +++ b/tests/testflows/rbac/configs/clickhouse/config.d/ports.xml @@ -2,4 +2,6 @@ 8443 9440 + 9005 + 9004 \ No newline at end of file diff --git a/tests/testflows/rbac/configs/clickhouse/config.xml b/tests/testflows/rbac/configs/clickhouse/config.xml new file mode 100644 index 00000000000..f71f14f4733 --- /dev/null +++ b/tests/testflows/rbac/configs/clickhouse/config.xml @@ -0,0 +1,456 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + 0.0.0.0 + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + /var/lib/clickhouse/access/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + users.xml + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + query_views_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 7200 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/rbac/configs/clickhouse/users.xml b/tests/testflows/rbac/configs/clickhouse/users.xml new file mode 100644 index 00000000000..c7d0ecae693 --- /dev/null +++ b/tests/testflows/rbac/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/rbac/rbac_env/Dockerfile b/tests/testflows/rbac/rbac_env/Dockerfile new file mode 100644 index 00000000000..1daacd9b49d --- /dev/null +++ b/tests/testflows/rbac/rbac_env/Dockerfile @@ -0,0 +1,7 @@ +FROM ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 + +RUN sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' +RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - + +RUN apt-get update +RUN apt-get -y install postgresql diff --git a/tests/testflows/rbac/rbac_env/clickhouse-service.yml b/tests/testflows/rbac/rbac_env/clickhouse-service.yml index c808372d7e9..6f5f88f9aa3 100755 --- a/tests/testflows/rbac/rbac_env/clickhouse-service.yml +++ b/tests/testflows/rbac/rbac_env/clickhouse-service.yml @@ -2,15 +2,21 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + build: + context: . + dockerfile: Dockerfile init: true expose: - "9000" - "9009" - "8123" volumes: - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/ssl:/etc/clickhouse-server/ssl" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" diff --git a/tests/testflows/rbac/rbac_env/docker-compose.yml b/tests/testflows/rbac/rbac_env/docker-compose.yml index 29f2ef52470..7e8faf53117 100755 --- a/tests/testflows/rbac/rbac_env/docker-compose.yml +++ b/tests/testflows/rbac/rbac_env/docker-compose.yml @@ -6,6 +6,14 @@ services: file: zookeeper-service.yml service: zookeeper + mysql1: + extends: + file: mysql-service.yml + service: mysql + hostname: mysql1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/mysql1/database:/var/lib/mysql" + clickhouse1: extends: file: clickhouse-service.yml @@ -48,7 +56,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/rbac/rbac_env/mysql-service.yml b/tests/testflows/rbac/rbac_env/mysql-service.yml new file mode 100644 index 00000000000..d23b28b396f --- /dev/null +++ b/tests/testflows/rbac/rbac_env/mysql-service.yml @@ -0,0 +1,19 @@ +version: '2.3' + +services: + mysql: + image: ${IMAGE_DEPENDENCY_PROXY}mysql:5.7.30 + restart: always + environment: + MYSQL_DATABASE: 'default' + MYSQL_USER: 'user' + MYSQL_PASSWORD: 'password' + MYSQL_ROOT_PASSWORD: 'password' + expose: + - '3306' + healthcheck: + test: mysql -D default -u user --password=password -e "select 1;" + interval: 3s + timeout: 2s + retries: 40 + start_period: 2s diff --git a/tests/testflows/rbac/rbac_env/zookeeper-service.yml b/tests/testflows/rbac/rbac_env/zookeeper-service.yml index f3df33358be..60c0e4e7de3 100755 --- a/tests/testflows/rbac/rbac_env/zookeeper-service.yml +++ b/tests/testflows/rbac/rbac_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/rbac/rbac_env_arm64/clickhouse-service.yml b/tests/testflows/rbac/rbac_env_arm64/clickhouse-service.yml index a7d6c7053d2..b9b20ece3a9 100755 --- a/tests/testflows/rbac/rbac_env_arm64/clickhouse-service.yml +++ b/tests/testflows/rbac/rbac_env_arm64/clickhouse-service.yml @@ -9,8 +9,12 @@ services: - "9009" - "8123" volumes: - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ports.xml:/etc/clickhouse-server/config.d/ports.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/ssl.xml:/etc/clickhouse-server/config.d/ssl.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/storage.xml:/etc/clickhouse-server/config.d/storage.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/ssl:/etc/clickhouse-server/ssl" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" diff --git a/tests/testflows/rbac/rbac_env_arm64/docker-compose.yml b/tests/testflows/rbac/rbac_env_arm64/docker-compose.yml index 29f2ef52470..c9ae33d7884 100755 --- a/tests/testflows/rbac/rbac_env_arm64/docker-compose.yml +++ b/tests/testflows/rbac/rbac_env_arm64/docker-compose.yml @@ -48,7 +48,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/rbac/rbac_env_arm64/zookeeper-service.yml b/tests/testflows/rbac/rbac_env_arm64/zookeeper-service.yml index f3df33358be..60c0e4e7de3 100755 --- a/tests/testflows/rbac/rbac_env_arm64/zookeeper-service.yml +++ b/tests/testflows/rbac/rbac_env_arm64/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/rbac/regression.py b/tests/testflows/rbac/regression.py index eb1d6c9acf7..cf242b0a92b 100755 --- a/tests/testflows/rbac/regression.py +++ b/tests/testflows/rbac/regression.py @@ -32,6 +32,9 @@ issue_21084 = "https://github.com/ClickHouse/ClickHouse/issues/21084" issue_25413 = "https://github.com/ClickHouse/ClickHouse/issues/25413" issue_26746 = "https://github.com/ClickHouse/ClickHouse/issues/26746" +issue_37389 = "https://github.com/ClickHouse/ClickHouse/issues/37389" +issue_37580 = "https://github.com/ClickHouse/ClickHouse/issues/37580" +issue_38716 = "https://github.com/ClickHouse/ClickHouse/issues/38716" xfails = { "syntax/show create quota/I show create quota current": [ @@ -184,6 +187,12 @@ "views/live view/create with join subquery privilege granted directly or via role/create with join subquery, privilege granted through a role": [ (Fail, issue_26746) ], + "privileges/table functions/cluster": [(Fail, issue_37389)], + "privileges/table functions/remote": [(Fail, issue_37389)], + "privileges/create row policy/remote": [(Fail, issue_37580)], + "privileges/system drop replica/:/drop replica/check privilege:/:": [ + (Fail, issue_38716) + ], } xflags = { @@ -210,6 +219,36 @@ and check_clickhouse_version("<21.10")(test) ), ), + "/clickhouse/rbac/privileges/system merges": ( + XFail, + "Does not work on clickhouse 21.8", + (lambda test: check_clickhouse_version("<21.9")(test)), + ), + "/clickhouse/rbac/privileges/system ttl merges": ( + XFail, + "Does not work on clickhouse 21.8", + (lambda test: check_clickhouse_version("<21.9")(test)), + ), + "/clickhouse/rbac/privileges/system moves": ( + XFail, + "Does not work on clickhouse 21.8", + (lambda test: check_clickhouse_version("<21.9")(test)), + ), + "/clickhouse/rbac/privileges/system sends": ( + XFail, + "Does not work on clickhouse 21.8", + (lambda test: check_clickhouse_version("<21.9")(test)), + ), + "/clickhouse/rbac/privileges/system fetches": ( + XFail, + "Does not work on clickhouse 21.8", + (lambda test: check_clickhouse_version("<21.9")(test)), + ), + "/clickhouse/rbac/privileges/system replication queues": ( + XFail, + "Does not work on clickhouse 21.8", + (lambda test: check_clickhouse_version("<21.9")(test)), + ), } diff --git a/tests/testflows/rbac/requirements/requirements.md b/tests/testflows/rbac/requirements/requirements.md index 1c59f51fce4..8d6bb9a11bb 100644 --- a/tests/testflows/rbac/requirements/requirements.md +++ b/tests/testflows/rbac/requirements/requirements.md @@ -2,6 +2,7 @@ # Software Requirements Specification ## Table of Contents + * 1 [Revision History](#revision-history) * 2 [Introduction](#introduction) * 3 [Terminology](#terminology) @@ -397,6 +398,9 @@ * 5.19.2 [RQ.SRS-006.RBAC.Select.Column](#rqsrs-006rbacselectcolumn) * 5.19.3 [RQ.SRS-006.RBAC.Select.Cluster](#rqsrs-006rbacselectcluster) * 5.19.4 [RQ.SRS-006.RBAC.Select.TableEngines](#rqsrs-006rbacselecttableengines) + * 5.19.5 [Table Functions](#table-functions) + * 5.19.5.1 [RQ.SRS-006.RBAC.Select.TableFunctions.Remote](#rqsrs-006rbacselecttablefunctionsremote) + * 5.19.5.2 [RQ.SRS-006.RBAC.Select.TableFunctions.Cluster](#rqsrs-006rbacselecttablefunctionscluster) * 5.20 [Insert](#insert) * 5.20.1 [RQ.SRS-006.RBAC.Insert](#rqsrs-006rbacinsert) * 5.20.2 [RQ.SRS-006.RBAC.Insert.Column](#rqsrs-006rbacinsertcolumn) @@ -459,20 +463,33 @@ * 5.21.10.2 [RQ.SRS-006.RBAC.Privileges.AlterMove.Grant](#rqsrs-006rbacprivilegesaltermovegrant) * 5.21.10.3 [RQ.SRS-006.RBAC.Privileges.AlterMove.Revoke](#rqsrs-006rbacprivilegesaltermoverevoke) * 5.21.10.4 [RQ.SRS-006.RBAC.Privileges.AlterMove.TableEngines](#rqsrs-006rbacprivilegesaltermovetableengines) + * 5.21.11 [Alter Projection](#alter-projection) + * 5.21.11.1 [RQ.SRS-006.RBAC.Privileges.AlterProjection](#rqsrs-006rbacprivilegesalterprojection) + * 5.21.11.2 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Add](#rqsrs-006rbacprivilegesalterprojectionadd) + * 5.21.11.3 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Drop](#rqsrs-006rbacprivilegesalterprojectiondrop) + * 5.21.11.4 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Materialize](#rqsrs-006rbacprivilegesalterprojectionmaterialize) + * 5.21.11.5 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Clear](#rqsrs-006rbacprivilegesalterprojectionclear) + * 5.21.12 [Alter Database](#alter-database) + * 5.21.12.1 [RQ.SRS-006.RBAC.Privileges.AlterDatabase](#rqsrs-006rbacprivilegesalterdatabase) + * 5.21.12.2 [RQ.SRS-006.RBAC.Privileges.AlterDatabase.Settings](#rqsrs-006rbacprivilegesalterdatabasesettings) * 5.22 [Create](#create) - * 5.22.1 [RQ.SRS-006.RBAC.Privileges.CreateTable](#rqsrs-006rbacprivilegescreatetable) - * 5.22.2 [RQ.SRS-006.RBAC.Privileges.CreateDatabase](#rqsrs-006rbacprivilegescreatedatabase) - * 5.22.3 [RQ.SRS-006.RBAC.Privileges.CreateDictionary](#rqsrs-006rbacprivilegescreatedictionary) - * 5.22.4 [RQ.SRS-006.RBAC.Privileges.CreateTemporaryTable](#rqsrs-006rbacprivilegescreatetemporarytable) + * 5.22.1 [RQ.SRS-006.RBAC.Privileges.Create](#rqsrs-006rbacprivilegescreate) + * 5.22.2 [RQ.SRS-006.RBAC.Privileges.CreateTable](#rqsrs-006rbacprivilegescreatetable) + * 5.22.3 [RQ.SRS-006.RBAC.Privileges.CreateDatabase](#rqsrs-006rbacprivilegescreatedatabase) + * 5.22.4 [RQ.SRS-006.RBAC.Privileges.CreateDictionary](#rqsrs-006rbacprivilegescreatedictionary) + * 5.22.5 [RQ.SRS-006.RBAC.Privileges.CreateTemporaryTable](#rqsrs-006rbacprivilegescreatetemporarytable) + * 5.22.6 [RQ.SRS-006.RBAC.Privileges.CreateFunction](#rqsrs-006rbacprivilegescreatefunction) * 5.23 [Attach](#attach) * 5.23.1 [RQ.SRS-006.RBAC.Privileges.AttachDatabase](#rqsrs-006rbacprivilegesattachdatabase) * 5.23.2 [RQ.SRS-006.RBAC.Privileges.AttachDictionary](#rqsrs-006rbacprivilegesattachdictionary) * 5.23.3 [RQ.SRS-006.RBAC.Privileges.AttachTemporaryTable](#rqsrs-006rbacprivilegesattachtemporarytable) * 5.23.4 [RQ.SRS-006.RBAC.Privileges.AttachTable](#rqsrs-006rbacprivilegesattachtable) * 5.24 [Drop](#drop) - * 5.24.1 [RQ.SRS-006.RBAC.Privileges.DropTable](#rqsrs-006rbacprivilegesdroptable) - * 5.24.2 [RQ.SRS-006.RBAC.Privileges.DropDatabase](#rqsrs-006rbacprivilegesdropdatabase) - * 5.24.3 [RQ.SRS-006.RBAC.Privileges.DropDictionary](#rqsrs-006rbacprivilegesdropdictionary) + * 5.24.1 [RQ.SRS-006.RBAC.Privileges.Drop](#rqsrs-006rbacprivilegesdrop) + * 5.24.2 [RQ.SRS-006.RBAC.Privileges.DropTable](#rqsrs-006rbacprivilegesdroptable) + * 5.24.3 [RQ.SRS-006.RBAC.Privileges.DropDatabase](#rqsrs-006rbacprivilegesdropdatabase) + * 5.24.4 [RQ.SRS-006.RBAC.Privileges.DropDictionary](#rqsrs-006rbacprivilegesdropdictionary) + * 5.24.5 [RQ.SRS-006.RBAC.Privileges.DropFunction](#rqsrs-006rbacprivilegesdropfunction) * 5.25 [Detach](#detach) * 5.25.1 [RQ.SRS-006.RBAC.Privileges.DetachTable](#rqsrs-006rbacprivilegesdetachtable) * 5.25.2 [RQ.SRS-006.RBAC.Privileges.DetachView](#rqsrs-006rbacprivilegesdetachview) @@ -550,32 +567,41 @@ * 5.33 [Introspection](#introspection) * 5.33.1 [RQ.SRS-006.RBAC.Privileges.Introspection](#rqsrs-006rbacprivilegesintrospection) * 5.33.2 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToLine](#rqsrs-006rbacprivilegesintrospectionaddresstoline) - * 5.33.3 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol](#rqsrs-006rbacprivilegesintrospectionaddresstosymbol) - * 5.33.4 [RQ.SRS-006.RBAC.Privileges.Introspection.demangle](#rqsrs-006rbacprivilegesintrospectiondemangle) + * 5.33.3 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToLineWithInlines](#rqsrs-006rbacprivilegesintrospectionaddresstolinewithinlines) + * 5.33.4 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol](#rqsrs-006rbacprivilegesintrospectionaddresstosymbol) + * 5.33.5 [RQ.SRS-006.RBAC.Privileges.Introspection.demangle](#rqsrs-006rbacprivilegesintrospectiondemangle) * 5.34 [System](#system) * 5.34.1 [RQ.SRS-006.RBAC.Privileges.System.Shutdown](#rqsrs-006rbacprivilegessystemshutdown) * 5.34.2 [RQ.SRS-006.RBAC.Privileges.System.DropCache](#rqsrs-006rbacprivilegessystemdropcache) * 5.34.3 [RQ.SRS-006.RBAC.Privileges.System.DropCache.DNS](#rqsrs-006rbacprivilegessystemdropcachedns) * 5.34.4 [RQ.SRS-006.RBAC.Privileges.System.DropCache.Mark](#rqsrs-006rbacprivilegessystemdropcachemark) * 5.34.5 [RQ.SRS-006.RBAC.Privileges.System.DropCache.Uncompressed](#rqsrs-006rbacprivilegessystemdropcacheuncompressed) - * 5.34.6 [RQ.SRS-006.RBAC.Privileges.System.Reload](#rqsrs-006rbacprivilegessystemreload) - * 5.34.7 [RQ.SRS-006.RBAC.Privileges.System.Reload.Config](#rqsrs-006rbacprivilegessystemreloadconfig) - * 5.34.8 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionary](#rqsrs-006rbacprivilegessystemreloaddictionary) - * 5.34.9 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionaries](#rqsrs-006rbacprivilegessystemreloaddictionaries) - * 5.34.10 [RQ.SRS-006.RBAC.Privileges.System.Reload.EmbeddedDictionaries](#rqsrs-006rbacprivilegessystemreloadembeddeddictionaries) - * 5.34.11 [RQ.SRS-006.RBAC.Privileges.System.Merges](#rqsrs-006rbacprivilegessystemmerges) - * 5.34.12 [RQ.SRS-006.RBAC.Privileges.System.TTLMerges](#rqsrs-006rbacprivilegessystemttlmerges) - * 5.34.13 [RQ.SRS-006.RBAC.Privileges.System.Fetches](#rqsrs-006rbacprivilegessystemfetches) - * 5.34.14 [RQ.SRS-006.RBAC.Privileges.System.Moves](#rqsrs-006rbacprivilegessystemmoves) - * 5.34.15 [RQ.SRS-006.RBAC.Privileges.System.Sends](#rqsrs-006rbacprivilegessystemsends) - * 5.34.16 [RQ.SRS-006.RBAC.Privileges.System.Sends.Distributed](#rqsrs-006rbacprivilegessystemsendsdistributed) - * 5.34.17 [RQ.SRS-006.RBAC.Privileges.System.Sends.Replicated](#rqsrs-006rbacprivilegessystemsendsreplicated) - * 5.34.18 [RQ.SRS-006.RBAC.Privileges.System.ReplicationQueues](#rqsrs-006rbacprivilegessystemreplicationqueues) - * 5.34.19 [RQ.SRS-006.RBAC.Privileges.System.SyncReplica](#rqsrs-006rbacprivilegessystemsyncreplica) - * 5.34.20 [RQ.SRS-006.RBAC.Privileges.System.RestartReplica](#rqsrs-006rbacprivilegessystemrestartreplica) - * 5.34.21 [RQ.SRS-006.RBAC.Privileges.System.Flush](#rqsrs-006rbacprivilegessystemflush) - * 5.34.22 [RQ.SRS-006.RBAC.Privileges.System.Flush.Distributed](#rqsrs-006rbacprivilegessystemflushdistributed) - * 5.34.23 [RQ.SRS-006.RBAC.Privileges.System.Flush.Logs](#rqsrs-006rbacprivilegessystemflushlogs) + * 5.34.6 [RQ.SRS-006.RBAC.Privileges.System.DropCache.Mmap](#rqsrs-006rbacprivilegessystemdropcachemmap) + * 5.34.7 [RQ.SRS-006.RBAC.Privileges.System.DropCache.CompiledExpression](#rqsrs-006rbacprivilegessystemdropcachecompiledexpression) + * 5.34.8 [RQ.SRS-006.RBAC.Privileges.System.Reload](#rqsrs-006rbacprivilegessystemreload) + * 5.34.9 [RQ.SRS-006.RBAC.Privileges.System.Reload.Config](#rqsrs-006rbacprivilegessystemreloadconfig) + * 5.34.10 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionary](#rqsrs-006rbacprivilegessystemreloaddictionary) + * 5.34.11 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionaries](#rqsrs-006rbacprivilegessystemreloaddictionaries) + * 5.34.12 [RQ.SRS-006.RBAC.Privileges.System.Reload.EmbeddedDictionaries](#rqsrs-006rbacprivilegessystemreloadembeddeddictionaries) + * 5.34.13 [RQ.SRS-006.RBAC.Privileges.System.Reload.Symbols](#rqsrs-006rbacprivilegessystemreloadsymbols) + * 5.34.14 [RQ.SRS-006.RBAC.Privileges.System.Reload.Function](#rqsrs-006rbacprivilegessystemreloadfunction) + * 5.34.15 [RQ.SRS-006.RBAC.Privileges.System.RestartDisk](#rqsrs-006rbacprivilegessystemrestartdisk) + * 5.34.16 [RQ.SRS-006.RBAC.Privileges.System.ThreadFuzzer](#rqsrs-006rbacprivilegessystemthreadfuzzer) + * 5.34.17 [RQ.SRS-006.RBAC.Privileges.System.Merges](#rqsrs-006rbacprivilegessystemmerges) + * 5.34.18 [RQ.SRS-006.RBAC.Privileges.System.TTLMerges](#rqsrs-006rbacprivilegessystemttlmerges) + * 5.34.19 [RQ.SRS-006.RBAC.Privileges.System.Fetches](#rqsrs-006rbacprivilegessystemfetches) + * 5.34.20 [RQ.SRS-006.RBAC.Privileges.System.Moves](#rqsrs-006rbacprivilegessystemmoves) + * 5.34.21 [RQ.SRS-006.RBAC.Privileges.System.Sends](#rqsrs-006rbacprivilegessystemsends) + * 5.34.22 [RQ.SRS-006.RBAC.Privileges.System.Sends.Distributed](#rqsrs-006rbacprivilegessystemsendsdistributed) + * 5.34.23 [RQ.SRS-006.RBAC.Privileges.System.Sends.Replicated](#rqsrs-006rbacprivilegessystemsendsreplicated) + * 5.34.24 [RQ.SRS-006.RBAC.Privileges.System.ReplicationQueues](#rqsrs-006rbacprivilegessystemreplicationqueues) + * 5.34.25 [RQ.SRS-006.RBAC.Privileges.System.SyncReplica](#rqsrs-006rbacprivilegessystemsyncreplica) + * 5.34.26 [RQ.SRS-006.RBAC.Privileges.System.RestartReplica](#rqsrs-006rbacprivilegessystemrestartreplica) + * 5.34.27 [RQ.SRS-006.RBAC.Privileges.System.DropReplica](#rqsrs-006rbacprivilegessystemdropreplica) + * 5.34.28 [RQ.SRS-006.RBAC.Privileges.System.RestoreReplica](#rqsrs-006rbacprivilegessystemrestorereplica) + * 5.34.29 [RQ.SRS-006.RBAC.Privileges.System.Flush](#rqsrs-006rbacprivilegessystemflush) + * 5.34.30 [RQ.SRS-006.RBAC.Privileges.System.Flush.Distributed](#rqsrs-006rbacprivilegessystemflushdistributed) + * 5.34.31 [RQ.SRS-006.RBAC.Privileges.System.Flush.Logs](#rqsrs-006rbacprivilegessystemflushlogs) * 5.35 [Sources](#sources) * 5.35.1 [RQ.SRS-006.RBAC.Privileges.Sources](#rqsrs-006rbacprivilegessources) * 5.35.2 [RQ.SRS-006.RBAC.Privileges.Sources.File](#rqsrs-006rbacprivilegessourcesfile) @@ -586,6 +612,9 @@ * 5.35.7 [RQ.SRS-006.RBAC.Privileges.Sources.JDBC](#rqsrs-006rbacprivilegessourcesjdbc) * 5.35.8 [RQ.SRS-006.RBAC.Privileges.Sources.HDFS](#rqsrs-006rbacprivilegessourceshdfs) * 5.35.9 [RQ.SRS-006.RBAC.Privileges.Sources.S3](#rqsrs-006rbacprivilegessourcess3) + * 5.35.10 [RQ.SRS-006.RBAC.Privileges.Sources.Mongo](#rqsrs-006rbacprivilegessourcesmongo) + * 5.35.11 [RQ.SRS-006.RBAC.Privileges.Sources.Postgres](#rqsrs-006rbacprivilegessourcespostgres) + * 5.35.12 [RQ.SRS-006.RBAC.Privileges.Sources.Sqlite](#rqsrs-006rbacprivilegessourcessqlite) * 5.36 [RQ.SRS-006.RBAC.Privileges.GrantOption](#rqsrs-006rbacprivilegesgrantoption) * 5.37 [RQ.SRS-006.RBAC.Privileges.All](#rqsrs-006rbacprivilegesall) * 5.38 [RQ.SRS-006.RBAC.Privileges.RoleAll](#rqsrs-006rbacprivilegesroleall) @@ -3222,6 +3251,21 @@ on tables created using the following engines * ReplicatedVersionedCollapsingMergeTree * ReplicatedGraphiteMergeTree +#### Table Functions + +##### RQ.SRS-006.RBAC.Select.TableFunctions.Remote +version: 1.0 + +[ClickHouse] SHALL only execute `SELECT FROM remote()` query if +the user has **REMOTE**, **CREATE TEMPORARY TABLE** and **SELECT** privileges. + + +##### RQ.SRS-006.RBAC.Select.TableFunctions.Cluster +version: 1.0 + +[ClickHouse] SHALL only execute `SELECT FROM cluster()` query if +the user has **REMOTE**, **CREATE TEMPORARY TABLE** and **SELECT** privileges. + ### Insert #### RQ.SRS-006.RBAC.Insert @@ -3278,7 +3322,7 @@ version: 1.0 [ClickHouse] SHALL support controlling access to the **alter column** privilege for a database or a specific table to one or more **users** or **roles**. -Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` statements SHALL +Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL return an error, unless the user has the **alter column** privilege for the destination table either because of the explicit grant or through one of the roles assigned to the user. @@ -3300,7 +3344,7 @@ version: 1.0 [ClickHouse] SHALL support granting or revoking **alter column** privilege for one or more specified columns in a table to one or more **users** or **roles**. -Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` statements SHALL return an error, +Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL return an error, unless the user has the **alter column** privilege for the destination column either because of the explicit grant or through one of the roles assigned to the user. @@ -3309,7 +3353,7 @@ version: 1.0 [ClickHouse] SHALL support granting or revoking **alter column** privilege on a specified cluster to one or more **users** or **roles**. -Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` +Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL succeed only on nodes where the table exists and privilege was granted. ##### RQ.SRS-006.RBAC.Privileges.AlterColumn.TableEngines @@ -3735,8 +3779,61 @@ on tables created using the following engines * ReplicatedVersionedCollapsingMergeTree * ReplicatedGraphiteMergeTree +#### Alter Projection + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER PROJECTION` privilege, +which permits users to **add**, **drop**, **materialize**, and **clear** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Add +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER ADD PROJECTION` privilege, +which permits users to **add** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Drop +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER DROP PROJECTION` privilege, +which permits users to **drop** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Materialize +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER MATERIALIZE PROJECTION` privilege, +which permits users to **materialize** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Clear +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER CLEAR PROJECTION` privilege, +which permits users to **clear** projections. + +#### Alter Database + +##### RQ.SRS-006.RBAC.Privileges.AlterDatabase +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER DATABASE` privilege, +which permits users to **alter** a database. + +##### RQ.SRS-006.RBAC.Privileges.AlterDatabase.Settings +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER DATABASE SETTINGS` privilege, +which permits users to **alter** the settings of a database. + ### Create +#### RQ.SRS-006.RBAC.Privileges.Create +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `CREATE` privilege, +which permits users to **create** tables, databases, dictionaries, and temporary tables. +This privilege does NOT grant the permission to create users, roles, or quotas, row policies, or settings profiles. + #### RQ.SRS-006.RBAC.Privileges.CreateTable version: 1.0 @@ -3773,6 +3870,12 @@ version: 1.0 [ClickHouse] SHALL successfully execute `CREATE TEMPORARY TABLE` statement if and only if the user has **create temporary table** privilege on the table, either directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.CreateFunction +version: 1.0 + +[ClickHouse] SHALL successfully execute `CREATE FUNCTION` statement if and only if the user has **create function** privilege, +either directly or through a role. + ### Attach #### RQ.SRS-006.RBAC.Privileges.AttachDatabase @@ -3801,6 +3904,13 @@ either directly or through a role. ### Drop +#### RQ.SRS-006.RBAC.Privileges.Drop +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `DROP` privilege, +which permits users to **drop** tables, databases, dictionaries, and temporary tables. +This privilege does NOT grant the permission to create users, roles, or quotas, row policies, or settings profiles. + #### RQ.SRS-006.RBAC.Privileges.DropTable version: 1.0 @@ -3819,6 +3929,12 @@ version: 1.0 [ClickHouse] SHALL successfully execute `DROP DICTIONARY` statement if and only if the user has **drop dictionary** privilege on the dictionary, either directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.DropFunction +version: 1.0 + +[ClickHouse] SHALL successfully execute `DROP FUNCTION` statement if and only if the user has **drop function** privilege, +either directly or through a role. + ### Detach #### RQ.SRS-006.RBAC.Privileges.DetachTable @@ -4258,6 +4374,12 @@ version: 1.0 [ClickHouse] SHALL successfully execute `addressToLine` statement if and only if the user has **introspection** privilege, either directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.Introspection.addressToLineWithInlines +version: 1.0 + +[ClickHouse] SHALL successfully execute `addressToLineWithInlines` statement if and only if +the user has **introspection** privilege, either directly or through a role. + #### RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol version: 1.0 @@ -4305,6 +4427,20 @@ version: 1.0 the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP UNCOMPRESSED CACHE`, `SYSTEM DROP UNCOMPRESSED`, `DROP UNCOMPRESSED CACHE`, or `DROP UNCOMPRESSED`. +#### RQ.SRS-006.RBAC.Privileges.System.DropCache.Mmap +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM DROP MMAP CACHE` privilege when +the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP MMAP CACHE`, +`SYSTEM DROP MMAP`, `DROP MMAP CACHE`, or `DROP MMAP`. + +#### RQ.SRS-006.RBAC.Privileges.System.DropCache.CompiledExpression +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM DROP COMPILED EXPRESSION CACHE` privilege when +the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP COMPILED EXPRESSION CACHE`, +`SYSTEM DROP COMPILED EXPRESSION`, or `DROP COMPILED EXPRESSION CACHE` + #### RQ.SRS-006.RBAC.Privileges.System.Reload version: 1.0 @@ -4335,6 +4471,30 @@ version: 1.0 [ClickHouse] SHALL successfully grant `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege when the user is granted `SYSTEM`, `SYSTEM RELOAD`, `SYSTEM RELOAD DICTIONARY ON *.*`, or `SYSTEM RELOAD EMBEDDED DICTIONARIES`. +#### RQ.SRS-006.RBAC.Privileges.System.Reload.Symbols +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RELOAD SYMBOLS` privilege when +the user is granted `SYSTEM`, `SYSTEM RELOAD`, or `SYSTEM RELOAD SYMBOLS`. + +#### RQ.SRS-006.RBAC.Privileges.System.Reload.Function +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RELOAD FUNCTION` privilege when +the user is granted `SYSTEM`, `SYSTEM RELOAD`, or `SYSTEM RELOAD FUNCTION`. + +#### RQ.SRS-006.RBAC.Privileges.System.RestartDisk +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RESTART DISK` privilege when +the user is granted `SYSTEM RESTART DISK`. + +#### RQ.SRS-006.RBAC.Privileges.System.ThreadFuzzer +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM THREAD FUZZER` privilege when +the user is granted `SYSTEM THREAD FUZZER`. + #### RQ.SRS-006.RBAC.Privileges.System.Merges version: 1.0 @@ -4398,6 +4558,18 @@ version: 1.0 [ClickHouse] SHALL successfully grant `SYSTEM RESTART REPLICA` privilege when the user is granted `SYSTEM`, `SYSTEM RESTART REPLICA`, or `RESTART REPLICA`. +#### RQ.SRS-006.RBAC.Privileges.System.DropReplica +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM DROP REPLICA` privilege when +the user is granted `SYSTEM`, `SYSTEM DROP REPLICA`, or `DROP REPLICA`. + +#### RQ.SRS-006.RBAC.Privileges.System.RestoreReplica +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RESTORE REPLICA` privilege when +the user is granted `SYSTEM`, `SYSTEM RESTORE REPLICA`, or `RESTORE REPLICA`. + #### RQ.SRS-006.RBAC.Privileges.System.Flush version: 1.0 @@ -4472,6 +4644,24 @@ version: 1.0 [ClickHouse] SHALL support the use of `S3` source by a user if and only if the user has `S3` or `SOURCES` privileges granted to them directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.Sources.Mongo +version: 1.0 + +[ClickHouse] SHALL support the use of `MONGO` source by a user if and only if +the user has `MONGO` or `SOURCES` privileges granted to them directly or through a role. + +#### RQ.SRS-006.RBAC.Privileges.Sources.Postgres +version: 1.0 + +[ClickHouse] SHALL support the use of `POSTGRES` source by a user if and only if +the user has `POSTGRES` or `SOURCES` privileges granted to them directly or through a role. + +#### RQ.SRS-006.RBAC.Privileges.Sources.Sqlite +version: 1.0 + +[ClickHouse] SHALL support the use of `SQLITE` source by a user if and only if +the user has `SQLITE` or `SOURCES` privileges granted to them directly or through a role. + ### RQ.SRS-006.RBAC.Privileges.GrantOption version: 1.0 diff --git a/tests/testflows/rbac/requirements/requirements.py b/tests/testflows/rbac/requirements/requirements.py index 552588e49b9..0dbd38eab41 100755 --- a/tests/testflows/rbac/requirements/requirements.py +++ b/tests/testflows/rbac/requirements/requirements.py @@ -1,6 +1,6 @@ # These requirements were auto generated # from software requirements specification (SRS) -# document by TestFlows v1.6.201216.1172002. +# document by TestFlows v1.9.220620.1143643. # Do not edit by hand but re-generate instead # using 'tfs requirements generate' command. from testflows.core import Specification @@ -6300,6 +6300,41 @@ num="5.19.4", ) +RQ_SRS_006_RBAC_Select_TableFunctions_Remote = Requirement( + name="RQ.SRS-006.RBAC.Select.TableFunctions.Remote", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL only execute `SELECT FROM remote()` query if\n" + "the user has **REMOTE**, **CREATE TEMPORARY TABLE** and **SELECT** privileges.\n" + "\n" + "\n" + ), + link=None, + level=4, + num="5.19.5.1", +) + +RQ_SRS_006_RBAC_Select_TableFunctions_Cluster = Requirement( + name="RQ.SRS-006.RBAC.Select.TableFunctions.Cluster", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL only execute `SELECT FROM cluster()` query if\n" + "the user has **REMOTE**, **CREATE TEMPORARY TABLE** and **SELECT** privileges.\n" + "\n" + ), + link=None, + level=4, + num="5.19.5.2", +) + RQ_SRS_006_RBAC_Insert = Requirement( name="RQ.SRS-006.RBAC.Insert", version="1.0", @@ -6399,7 +6434,7 @@ description=( "[ClickHouse] SHALL support controlling access to the **alter column** privilege\n" "for a database or a specific table to one or more **users** or **roles**.\n" - "Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` statements SHALL\n" + "Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL\n" "return an error, unless the user has the **alter column** privilege for\n" "the destination table either because of the explicit grant or through one of\n" "the roles assigned to the user.\n" @@ -6454,7 +6489,7 @@ description=( "[ClickHouse] SHALL support granting or revoking **alter column** privilege\n" "for one or more specified columns in a table to one or more **users** or **roles**.\n" - "Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` statements SHALL return an error,\n" + "Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL return an error,\n" "unless the user has the **alter column** privilege for the destination column\n" "either because of the explicit grant or through one of the roles assigned to the user.\n" "\n" @@ -6474,7 +6509,7 @@ description=( "[ClickHouse] SHALL support granting or revoking **alter column** privilege\n" "on a specified cluster to one or more **users** or **roles**.\n" - "Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN`\n" + "Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN`\n" "statements SHALL succeed only on nodes where the table exists and privilege was granted.\n" "\n" ), @@ -7339,6 +7374,143 @@ num="5.21.10.4", ) +RQ_SRS_006_RBAC_Privileges_AlterProjection = Requirement( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `ALTER PROJECTION` privilege,\n" + "which permits users to **add**, **drop**, **materialize**, and **clear** projections.\n" + "\n" + ), + link=None, + level=4, + num="5.21.11.1", +) + +RQ_SRS_006_RBAC_Privileges_AlterProjection_Add = Requirement( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Add", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `ALTER ADD PROJECTION` privilege,\n" + "which permits users to **add** projections.\n" + "\n" + ), + link=None, + level=4, + num="5.21.11.2", +) + +RQ_SRS_006_RBAC_Privileges_AlterProjection_Drop = Requirement( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Drop", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `ALTER DROP PROJECTION` privilege,\n" + "which permits users to **drop** projections.\n" + "\n" + ), + link=None, + level=4, + num="5.21.11.3", +) + +RQ_SRS_006_RBAC_Privileges_AlterProjection_Materialize = Requirement( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Materialize", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `ALTER MATERIALIZE PROJECTION` privilege,\n" + "which permits users to **materialize** projections.\n" + "\n" + ), + link=None, + level=4, + num="5.21.11.4", +) + +RQ_SRS_006_RBAC_Privileges_AlterProjection_Clear = Requirement( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Clear", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `ALTER CLEAR PROJECTION` privilege,\n" + "which permits users to **clear** projections.\n" + "\n" + ), + link=None, + level=4, + num="5.21.11.5", +) + +RQ_SRS_006_RBAC_Privileges_AlterDatabase = Requirement( + name="RQ.SRS-006.RBAC.Privileges.AlterDatabase", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `ALTER DATABASE` privilege,\n" + "which permits users to **alter** a database.\n" + "\n" + ), + link=None, + level=4, + num="5.21.12.1", +) + +RQ_SRS_006_RBAC_Privileges_AlterDatabase_Settings = Requirement( + name="RQ.SRS-006.RBAC.Privileges.AlterDatabase.Settings", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `ALTER DATABASE SETTINGS` privilege,\n" + "which permits users to **alter** the settings of a database.\n" + "\n" + ), + link=None, + level=4, + num="5.21.12.2", +) + +RQ_SRS_006_RBAC_Privileges_Create = Requirement( + name="RQ.SRS-006.RBAC.Privileges.Create", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `CREATE` privilege,\n" + "which permits users to **create** tables, databases, dictionaries, and temporary tables.\n" + "This privilege does NOT grant the permission to create users, roles, or quotas, row policies, or settings profiles.\n" + "\n" + ), + link=None, + level=3, + num="5.22.1", +) + RQ_SRS_006_RBAC_Privileges_CreateTable = Requirement( name="RQ.SRS-006.RBAC.Privileges.CreateTable", version="1.0", @@ -7365,7 +7537,7 @@ ), link=None, level=3, - num="5.22.1", + num="5.22.2", ) RQ_SRS_006_RBAC_Privileges_CreateDatabase = Requirement( @@ -7382,7 +7554,7 @@ ), link=None, level=3, - num="5.22.2", + num="5.22.3", ) RQ_SRS_006_RBAC_Privileges_CreateDictionary = Requirement( @@ -7399,7 +7571,7 @@ ), link=None, level=3, - num="5.22.3", + num="5.22.4", ) RQ_SRS_006_RBAC_Privileges_CreateTemporaryTable = Requirement( @@ -7416,7 +7588,24 @@ ), link=None, level=3, - num="5.22.4", + num="5.22.5", +) + +RQ_SRS_006_RBAC_Privileges_CreateFunction = Requirement( + name="RQ.SRS-006.RBAC.Privileges.CreateFunction", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully execute `CREATE FUNCTION` statement if and only if the user has **create function** privilege,\n" + "either directly or through a role.\n" + "\n" + ), + link=None, + level=3, + num="5.22.6", ) RQ_SRS_006_RBAC_Privileges_AttachDatabase = Requirement( @@ -7487,6 +7676,24 @@ num="5.23.4", ) +RQ_SRS_006_RBAC_Privileges_Drop = Requirement( + name="RQ.SRS-006.RBAC.Privileges.Drop", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support granting and revoking `DROP` privilege,\n" + "which permits users to **drop** tables, databases, dictionaries, and temporary tables.\n" + "This privilege does NOT grant the permission to create users, roles, or quotas, row policies, or settings profiles.\n" + "\n" + ), + link=None, + level=3, + num="5.24.1", +) + RQ_SRS_006_RBAC_Privileges_DropTable = Requirement( name="RQ.SRS-006.RBAC.Privileges.DropTable", version="1.0", @@ -7501,7 +7708,7 @@ ), link=None, level=3, - num="5.24.1", + num="5.24.2", ) RQ_SRS_006_RBAC_Privileges_DropDatabase = Requirement( @@ -7518,7 +7725,7 @@ ), link=None, level=3, - num="5.24.2", + num="5.24.3", ) RQ_SRS_006_RBAC_Privileges_DropDictionary = Requirement( @@ -7535,7 +7742,24 @@ ), link=None, level=3, - num="5.24.3", + num="5.24.4", +) + +RQ_SRS_006_RBAC_Privileges_DropFunction = Requirement( + name="RQ.SRS-006.RBAC.Privileges.DropFunction", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully execute `DROP FUNCTION` statement if and only if the user has **drop function** privilege,\n" + "either directly or through a role.\n" + "\n" + ), + link=None, + level=3, + num="5.24.5", ) RQ_SRS_006_RBAC_Privileges_DetachTable = Requirement( @@ -8694,6 +8918,23 @@ num="5.33.2", ) +RQ_SRS_006_RBAC_Privileges_Introspection_addressToLineWithInlines = Requirement( + name="RQ.SRS-006.RBAC.Privileges.Introspection.addressToLineWithInlines", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully execute `addressToLineWithInlines` statement if and only if\n" + "the user has **introspection** privilege, either directly or through a role.\n" + "\n" + ), + link=None, + level=3, + num="5.33.3", +) + RQ_SRS_006_RBAC_Privileges_Introspection_addressToSymbol = Requirement( name="RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol", version="1.0", @@ -8708,7 +8949,7 @@ ), link=None, level=3, - num="5.33.3", + num="5.33.4", ) RQ_SRS_006_RBAC_Privileges_Introspection_demangle = Requirement( @@ -8725,7 +8966,7 @@ ), link=None, level=3, - num="5.33.4", + num="5.33.5", ) RQ_SRS_006_RBAC_Privileges_System_Shutdown = Requirement( @@ -8816,6 +9057,42 @@ num="5.34.5", ) +RQ_SRS_006_RBAC_Privileges_System_DropCache_Mmap = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.DropCache.Mmap", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM DROP MMAP CACHE` privilege when\n" + "the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP MMAP CACHE`,\n" + "`SYSTEM DROP MMAP`, `DROP MMAP CACHE`, or `DROP MMAP`.\n" + "\n" + ), + link=None, + level=3, + num="5.34.6", +) + +RQ_SRS_006_RBAC_Privileges_System_DropCache_CompiledExpression = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.DropCache.CompiledExpression", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM DROP COMPILED EXPRESSION CACHE` privilege when\n" + "the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP COMPILED EXPRESSION CACHE`,\n" + "`SYSTEM DROP COMPILED EXPRESSION`, or `DROP COMPILED EXPRESSION CACHE`\n" + "\n" + ), + link=None, + level=3, + num="5.34.7", +) + RQ_SRS_006_RBAC_Privileges_System_Reload = Requirement( name="RQ.SRS-006.RBAC.Privileges.System.Reload", version="1.0", @@ -8830,7 +9107,7 @@ ), link=None, level=3, - num="5.34.6", + num="5.34.8", ) RQ_SRS_006_RBAC_Privileges_System_Reload_Config = Requirement( @@ -8847,7 +9124,7 @@ ), link=None, level=3, - num="5.34.7", + num="5.34.9", ) RQ_SRS_006_RBAC_Privileges_System_Reload_Dictionary = Requirement( @@ -8864,7 +9141,7 @@ ), link=None, level=3, - num="5.34.8", + num="5.34.10", ) RQ_SRS_006_RBAC_Privileges_System_Reload_Dictionaries = Requirement( @@ -8881,7 +9158,7 @@ ), link=None, level=3, - num="5.34.9", + num="5.34.11", ) RQ_SRS_006_RBAC_Privileges_System_Reload_EmbeddedDictionaries = Requirement( @@ -8898,7 +9175,75 @@ ), link=None, level=3, - num="5.34.10", + num="5.34.12", +) + +RQ_SRS_006_RBAC_Privileges_System_Reload_Symbols = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.Reload.Symbols", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM RELOAD SYMBOLS` privilege when\n" + "the user is granted `SYSTEM`, `SYSTEM RELOAD`, or `SYSTEM RELOAD SYMBOLS`.\n" + "\n" + ), + link=None, + level=3, + num="5.34.13", +) + +RQ_SRS_006_RBAC_Privileges_System_Reload_Function = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.Reload.Function", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM RELOAD FUNCTION` privilege when\n" + "the user is granted `SYSTEM`, `SYSTEM RELOAD`, or `SYSTEM RELOAD FUNCTION`.\n" + "\n" + ), + link=None, + level=3, + num="5.34.14", +) + +RQ_SRS_006_RBAC_Privileges_System_RestartDisk = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.RestartDisk", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM RESTART DISK` privilege when\n" + "the user is granted `SYSTEM RESTART DISK`.\n" + "\n" + ), + link=None, + level=3, + num="5.34.15", +) + +RQ_SRS_006_RBAC_Privileges_System_ThreadFuzzer = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.ThreadFuzzer", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM THREAD FUZZER` privilege when\n" + "the user is granted `SYSTEM THREAD FUZZER`.\n" + "\n" + ), + link=None, + level=3, + num="5.34.16", ) RQ_SRS_006_RBAC_Privileges_System_Merges = Requirement( @@ -8915,7 +9260,7 @@ ), link=None, level=3, - num="5.34.11", + num="5.34.17", ) RQ_SRS_006_RBAC_Privileges_System_TTLMerges = Requirement( @@ -8932,7 +9277,7 @@ ), link=None, level=3, - num="5.34.12", + num="5.34.18", ) RQ_SRS_006_RBAC_Privileges_System_Fetches = Requirement( @@ -8949,7 +9294,7 @@ ), link=None, level=3, - num="5.34.13", + num="5.34.19", ) RQ_SRS_006_RBAC_Privileges_System_Moves = Requirement( @@ -8966,7 +9311,7 @@ ), link=None, level=3, - num="5.34.14", + num="5.34.20", ) RQ_SRS_006_RBAC_Privileges_System_Sends = Requirement( @@ -8983,7 +9328,7 @@ ), link=None, level=3, - num="5.34.15", + num="5.34.21", ) RQ_SRS_006_RBAC_Privileges_System_Sends_Distributed = Requirement( @@ -9001,7 +9346,7 @@ ), link=None, level=3, - num="5.34.16", + num="5.34.22", ) RQ_SRS_006_RBAC_Privileges_System_Sends_Replicated = Requirement( @@ -9019,7 +9364,7 @@ ), link=None, level=3, - num="5.34.17", + num="5.34.23", ) RQ_SRS_006_RBAC_Privileges_System_ReplicationQueues = Requirement( @@ -9037,7 +9382,7 @@ ), link=None, level=3, - num="5.34.18", + num="5.34.24", ) RQ_SRS_006_RBAC_Privileges_System_SyncReplica = Requirement( @@ -9054,7 +9399,7 @@ ), link=None, level=3, - num="5.34.19", + num="5.34.25", ) RQ_SRS_006_RBAC_Privileges_System_RestartReplica = Requirement( @@ -9071,7 +9416,41 @@ ), link=None, level=3, - num="5.34.20", + num="5.34.26", +) + +RQ_SRS_006_RBAC_Privileges_System_DropReplica = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.DropReplica", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM DROP REPLICA` privilege when\n" + "the user is granted `SYSTEM`, `SYSTEM DROP REPLICA`, or `DROP REPLICA`.\n" + "\n" + ), + link=None, + level=3, + num="5.34.27", +) + +RQ_SRS_006_RBAC_Privileges_System_RestoreReplica = Requirement( + name="RQ.SRS-006.RBAC.Privileges.System.RestoreReplica", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL successfully grant `SYSTEM RESTORE REPLICA` privilege when\n" + "the user is granted `SYSTEM`, `SYSTEM RESTORE REPLICA`, or `RESTORE REPLICA`.\n" + "\n" + ), + link=None, + level=3, + num="5.34.28", ) RQ_SRS_006_RBAC_Privileges_System_Flush = Requirement( @@ -9088,7 +9467,7 @@ ), link=None, level=3, - num="5.34.21", + num="5.34.29", ) RQ_SRS_006_RBAC_Privileges_System_Flush_Distributed = Requirement( @@ -9105,7 +9484,7 @@ ), link=None, level=3, - num="5.34.22", + num="5.34.30", ) RQ_SRS_006_RBAC_Privileges_System_Flush_Logs = Requirement( @@ -9122,7 +9501,7 @@ ), link=None, level=3, - num="5.34.23", + num="5.34.31", ) RQ_SRS_006_RBAC_Privileges_Sources = Requirement( @@ -9278,6 +9657,57 @@ num="5.35.9", ) +RQ_SRS_006_RBAC_Privileges_Sources_Mongo = Requirement( + name="RQ.SRS-006.RBAC.Privileges.Sources.Mongo", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support the use of `MONGO` source by a user if and only if\n" + "the user has `MONGO` or `SOURCES` privileges granted to them directly or through a role.\n" + "\n" + ), + link=None, + level=3, + num="5.35.10", +) + +RQ_SRS_006_RBAC_Privileges_Sources_Postgres = Requirement( + name="RQ.SRS-006.RBAC.Privileges.Sources.Postgres", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support the use of `POSTGRES` source by a user if and only if\n" + "the user has `POSTGRES` or `SOURCES` privileges granted to them directly or through a role.\n" + "\n" + ), + link=None, + level=3, + num="5.35.11", +) + +RQ_SRS_006_RBAC_Privileges_Sources_Sqlite = Requirement( + name="RQ.SRS-006.RBAC.Privileges.Sources.Sqlite", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support the use of `SQLITE` source by a user if and only if\n" + "the user has `SQLITE` or `SOURCES` privileges granted to them directly or through a role.\n" + "\n" + ), + link=None, + level=3, + num="5.35.12", +) + RQ_SRS_006_RBAC_Privileges_GrantOption = Requirement( name="RQ.SRS-006.RBAC.Privileges.GrantOption", version="1.0", @@ -10219,6 +10649,15 @@ Heading(name="RQ.SRS-006.RBAC.Select.Column", level=3, num="5.19.2"), Heading(name="RQ.SRS-006.RBAC.Select.Cluster", level=3, num="5.19.3"), Heading(name="RQ.SRS-006.RBAC.Select.TableEngines", level=3, num="5.19.4"), + Heading(name="Table Functions", level=3, num="5.19.5"), + Heading( + name="RQ.SRS-006.RBAC.Select.TableFunctions.Remote", level=4, num="5.19.5.1" + ), + Heading( + name="RQ.SRS-006.RBAC.Select.TableFunctions.Cluster", + level=4, + num="5.19.5.2", + ), Heading(name="Insert", level=2, num="5.20"), Heading(name="RQ.SRS-006.RBAC.Insert", level=3, num="5.20.1"), Heading(name="RQ.SRS-006.RBAC.Insert.Column", level=3, num="5.20.2"), @@ -10403,18 +10842,55 @@ level=4, num="5.21.10.4", ), + Heading(name="Alter Projection", level=3, num="5.21.11"), + Heading( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection", level=4, num="5.21.11.1" + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Add", + level=4, + num="5.21.11.2", + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Drop", + level=4, + num="5.21.11.3", + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Materialize", + level=4, + num="5.21.11.4", + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.AlterProjection.Clear", + level=4, + num="5.21.11.5", + ), + Heading(name="Alter Database", level=3, num="5.21.12"), + Heading( + name="RQ.SRS-006.RBAC.Privileges.AlterDatabase", level=4, num="5.21.12.1" + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.AlterDatabase.Settings", + level=4, + num="5.21.12.2", + ), Heading(name="Create", level=2, num="5.22"), - Heading(name="RQ.SRS-006.RBAC.Privileges.CreateTable", level=3, num="5.22.1"), + Heading(name="RQ.SRS-006.RBAC.Privileges.Create", level=3, num="5.22.1"), + Heading(name="RQ.SRS-006.RBAC.Privileges.CreateTable", level=3, num="5.22.2"), Heading( - name="RQ.SRS-006.RBAC.Privileges.CreateDatabase", level=3, num="5.22.2" + name="RQ.SRS-006.RBAC.Privileges.CreateDatabase", level=3, num="5.22.3" ), Heading( - name="RQ.SRS-006.RBAC.Privileges.CreateDictionary", level=3, num="5.22.3" + name="RQ.SRS-006.RBAC.Privileges.CreateDictionary", level=3, num="5.22.4" ), Heading( name="RQ.SRS-006.RBAC.Privileges.CreateTemporaryTable", level=3, - num="5.22.4", + num="5.22.5", + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.CreateFunction", level=3, num="5.22.6" ), Heading(name="Attach", level=2, num="5.23"), Heading( @@ -10430,11 +10906,13 @@ ), Heading(name="RQ.SRS-006.RBAC.Privileges.AttachTable", level=3, num="5.23.4"), Heading(name="Drop", level=2, num="5.24"), - Heading(name="RQ.SRS-006.RBAC.Privileges.DropTable", level=3, num="5.24.1"), - Heading(name="RQ.SRS-006.RBAC.Privileges.DropDatabase", level=3, num="5.24.2"), + Heading(name="RQ.SRS-006.RBAC.Privileges.Drop", level=3, num="5.24.1"), + Heading(name="RQ.SRS-006.RBAC.Privileges.DropTable", level=3, num="5.24.2"), + Heading(name="RQ.SRS-006.RBAC.Privileges.DropDatabase", level=3, num="5.24.3"), Heading( - name="RQ.SRS-006.RBAC.Privileges.DropDictionary", level=3, num="5.24.3" + name="RQ.SRS-006.RBAC.Privileges.DropDictionary", level=3, num="5.24.4" ), + Heading(name="RQ.SRS-006.RBAC.Privileges.DropFunction", level=3, num="5.24.5"), Heading(name="Detach", level=2, num="5.25"), Heading(name="RQ.SRS-006.RBAC.Privileges.DetachTable", level=3, num="5.25.1"), Heading(name="RQ.SRS-006.RBAC.Privileges.DetachView", level=3, num="5.25.2"), @@ -10651,15 +11129,20 @@ num="5.33.2", ), Heading( - name="RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol", + name="RQ.SRS-006.RBAC.Privileges.Introspection.addressToLineWithInlines", level=3, num="5.33.3", ), Heading( - name="RQ.SRS-006.RBAC.Privileges.Introspection.demangle", + name="RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol", level=3, num="5.33.4", ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.Introspection.demangle", + level=3, + num="5.33.5", + ), Heading(name="System", level=2, num="5.34"), Heading( name="RQ.SRS-006.RBAC.Privileges.System.Shutdown", level=3, num="5.34.1" @@ -10682,69 +11165,105 @@ level=3, num="5.34.5", ), - Heading(name="RQ.SRS-006.RBAC.Privileges.System.Reload", level=3, num="5.34.6"), Heading( - name="RQ.SRS-006.RBAC.Privileges.System.Reload.Config", + name="RQ.SRS-006.RBAC.Privileges.System.DropCache.Mmap", + level=3, + num="5.34.6", + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.DropCache.CompiledExpression", level=3, num="5.34.7", ), + Heading(name="RQ.SRS-006.RBAC.Privileges.System.Reload", level=3, num="5.34.8"), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.Reload.Config", + level=3, + num="5.34.9", + ), Heading( name="RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionary", level=3, - num="5.34.8", + num="5.34.10", ), Heading( name="RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionaries", level=3, - num="5.34.9", + num="5.34.11", ), Heading( name="RQ.SRS-006.RBAC.Privileges.System.Reload.EmbeddedDictionaries", level=3, - num="5.34.10", + num="5.34.12", ), Heading( - name="RQ.SRS-006.RBAC.Privileges.System.Merges", level=3, num="5.34.11" + name="RQ.SRS-006.RBAC.Privileges.System.Reload.Symbols", + level=3, + num="5.34.13", ), Heading( - name="RQ.SRS-006.RBAC.Privileges.System.TTLMerges", level=3, num="5.34.12" + name="RQ.SRS-006.RBAC.Privileges.System.Reload.Function", + level=3, + num="5.34.14", ), Heading( - name="RQ.SRS-006.RBAC.Privileges.System.Fetches", level=3, num="5.34.13" + name="RQ.SRS-006.RBAC.Privileges.System.RestartDisk", level=3, num="5.34.15" ), - Heading(name="RQ.SRS-006.RBAC.Privileges.System.Moves", level=3, num="5.34.14"), - Heading(name="RQ.SRS-006.RBAC.Privileges.System.Sends", level=3, num="5.34.15"), Heading( - name="RQ.SRS-006.RBAC.Privileges.System.Sends.Distributed", + name="RQ.SRS-006.RBAC.Privileges.System.ThreadFuzzer", level=3, num="5.34.16", ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.Merges", level=3, num="5.34.17" + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.TTLMerges", level=3, num="5.34.18" + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.Fetches", level=3, num="5.34.19" + ), + Heading(name="RQ.SRS-006.RBAC.Privileges.System.Moves", level=3, num="5.34.20"), + Heading(name="RQ.SRS-006.RBAC.Privileges.System.Sends", level=3, num="5.34.21"), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.Sends.Distributed", + level=3, + num="5.34.22", + ), Heading( name="RQ.SRS-006.RBAC.Privileges.System.Sends.Replicated", level=3, - num="5.34.17", + num="5.34.23", ), Heading( name="RQ.SRS-006.RBAC.Privileges.System.ReplicationQueues", level=3, - num="5.34.18", + num="5.34.24", ), Heading( - name="RQ.SRS-006.RBAC.Privileges.System.SyncReplica", level=3, num="5.34.19" + name="RQ.SRS-006.RBAC.Privileges.System.SyncReplica", level=3, num="5.34.25" ), Heading( name="RQ.SRS-006.RBAC.Privileges.System.RestartReplica", level=3, - num="5.34.20", + num="5.34.26", + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.DropReplica", level=3, num="5.34.27" + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.System.RestoreReplica", + level=3, + num="5.34.28", ), - Heading(name="RQ.SRS-006.RBAC.Privileges.System.Flush", level=3, num="5.34.21"), + Heading(name="RQ.SRS-006.RBAC.Privileges.System.Flush", level=3, num="5.34.29"), Heading( name="RQ.SRS-006.RBAC.Privileges.System.Flush.Distributed", level=3, - num="5.34.22", + num="5.34.30", ), Heading( - name="RQ.SRS-006.RBAC.Privileges.System.Flush.Logs", level=3, num="5.34.23" + name="RQ.SRS-006.RBAC.Privileges.System.Flush.Logs", level=3, num="5.34.31" ), Heading(name="Sources", level=2, num="5.35"), Heading(name="RQ.SRS-006.RBAC.Privileges.Sources", level=3, num="5.35.1"), @@ -10758,6 +11277,15 @@ Heading(name="RQ.SRS-006.RBAC.Privileges.Sources.JDBC", level=3, num="5.35.7"), Heading(name="RQ.SRS-006.RBAC.Privileges.Sources.HDFS", level=3, num="5.35.8"), Heading(name="RQ.SRS-006.RBAC.Privileges.Sources.S3", level=3, num="5.35.9"), + Heading( + name="RQ.SRS-006.RBAC.Privileges.Sources.Mongo", level=3, num="5.35.10" + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.Sources.Postgres", level=3, num="5.35.11" + ), + Heading( + name="RQ.SRS-006.RBAC.Privileges.Sources.Sqlite", level=3, num="5.35.12" + ), Heading(name="RQ.SRS-006.RBAC.Privileges.GrantOption", level=2, num="5.36"), Heading(name="RQ.SRS-006.RBAC.Privileges.All", level=2, num="5.37"), Heading(name="RQ.SRS-006.RBAC.Privileges.RoleAll", level=2, num="5.38"), @@ -11113,6 +11641,8 @@ RQ_SRS_006_RBAC_Select_Column, RQ_SRS_006_RBAC_Select_Cluster, RQ_SRS_006_RBAC_Select_TableEngines, + RQ_SRS_006_RBAC_Select_TableFunctions_Remote, + RQ_SRS_006_RBAC_Select_TableFunctions_Cluster, RQ_SRS_006_RBAC_Insert, RQ_SRS_006_RBAC_Insert_Column, RQ_SRS_006_RBAC_Insert_Cluster, @@ -11163,17 +11693,28 @@ RQ_SRS_006_RBAC_Privileges_AlterMove_Grant, RQ_SRS_006_RBAC_Privileges_AlterMove_Revoke, RQ_SRS_006_RBAC_Privileges_AlterMove_TableEngines, + RQ_SRS_006_RBAC_Privileges_AlterProjection, + RQ_SRS_006_RBAC_Privileges_AlterProjection_Add, + RQ_SRS_006_RBAC_Privileges_AlterProjection_Drop, + RQ_SRS_006_RBAC_Privileges_AlterProjection_Materialize, + RQ_SRS_006_RBAC_Privileges_AlterProjection_Clear, + RQ_SRS_006_RBAC_Privileges_AlterDatabase, + RQ_SRS_006_RBAC_Privileges_AlterDatabase_Settings, + RQ_SRS_006_RBAC_Privileges_Create, RQ_SRS_006_RBAC_Privileges_CreateTable, RQ_SRS_006_RBAC_Privileges_CreateDatabase, RQ_SRS_006_RBAC_Privileges_CreateDictionary, RQ_SRS_006_RBAC_Privileges_CreateTemporaryTable, + RQ_SRS_006_RBAC_Privileges_CreateFunction, RQ_SRS_006_RBAC_Privileges_AttachDatabase, RQ_SRS_006_RBAC_Privileges_AttachDictionary, RQ_SRS_006_RBAC_Privileges_AttachTemporaryTable, RQ_SRS_006_RBAC_Privileges_AttachTable, + RQ_SRS_006_RBAC_Privileges_Drop, RQ_SRS_006_RBAC_Privileges_DropTable, RQ_SRS_006_RBAC_Privileges_DropDatabase, RQ_SRS_006_RBAC_Privileges_DropDictionary, + RQ_SRS_006_RBAC_Privileges_DropFunction, RQ_SRS_006_RBAC_Privileges_DetachTable, RQ_SRS_006_RBAC_Privileges_DetachView, RQ_SRS_006_RBAC_Privileges_DetachDatabase, @@ -11241,6 +11782,7 @@ RQ_SRS_006_RBAC_dictIsIn_RequiredPrivilege, RQ_SRS_006_RBAC_Privileges_Introspection, RQ_SRS_006_RBAC_Privileges_Introspection_addressToLine, + RQ_SRS_006_RBAC_Privileges_Introspection_addressToLineWithInlines, RQ_SRS_006_RBAC_Privileges_Introspection_addressToSymbol, RQ_SRS_006_RBAC_Privileges_Introspection_demangle, RQ_SRS_006_RBAC_Privileges_System_Shutdown, @@ -11248,11 +11790,17 @@ RQ_SRS_006_RBAC_Privileges_System_DropCache_DNS, RQ_SRS_006_RBAC_Privileges_System_DropCache_Mark, RQ_SRS_006_RBAC_Privileges_System_DropCache_Uncompressed, + RQ_SRS_006_RBAC_Privileges_System_DropCache_Mmap, + RQ_SRS_006_RBAC_Privileges_System_DropCache_CompiledExpression, RQ_SRS_006_RBAC_Privileges_System_Reload, RQ_SRS_006_RBAC_Privileges_System_Reload_Config, RQ_SRS_006_RBAC_Privileges_System_Reload_Dictionary, RQ_SRS_006_RBAC_Privileges_System_Reload_Dictionaries, RQ_SRS_006_RBAC_Privileges_System_Reload_EmbeddedDictionaries, + RQ_SRS_006_RBAC_Privileges_System_Reload_Symbols, + RQ_SRS_006_RBAC_Privileges_System_Reload_Function, + RQ_SRS_006_RBAC_Privileges_System_RestartDisk, + RQ_SRS_006_RBAC_Privileges_System_ThreadFuzzer, RQ_SRS_006_RBAC_Privileges_System_Merges, RQ_SRS_006_RBAC_Privileges_System_TTLMerges, RQ_SRS_006_RBAC_Privileges_System_Fetches, @@ -11263,6 +11811,8 @@ RQ_SRS_006_RBAC_Privileges_System_ReplicationQueues, RQ_SRS_006_RBAC_Privileges_System_SyncReplica, RQ_SRS_006_RBAC_Privileges_System_RestartReplica, + RQ_SRS_006_RBAC_Privileges_System_DropReplica, + RQ_SRS_006_RBAC_Privileges_System_RestoreReplica, RQ_SRS_006_RBAC_Privileges_System_Flush, RQ_SRS_006_RBAC_Privileges_System_Flush_Distributed, RQ_SRS_006_RBAC_Privileges_System_Flush_Logs, @@ -11275,6 +11825,9 @@ RQ_SRS_006_RBAC_Privileges_Sources_JDBC, RQ_SRS_006_RBAC_Privileges_Sources_HDFS, RQ_SRS_006_RBAC_Privileges_Sources_S3, + RQ_SRS_006_RBAC_Privileges_Sources_Mongo, + RQ_SRS_006_RBAC_Privileges_Sources_Postgres, + RQ_SRS_006_RBAC_Privileges_Sources_Sqlite, RQ_SRS_006_RBAC_Privileges_GrantOption, RQ_SRS_006_RBAC_Privileges_All, RQ_SRS_006_RBAC_Privileges_RoleAll, @@ -11286,6 +11839,7 @@ # Software Requirements Specification ## Table of Contents + * 1 [Revision History](#revision-history) * 2 [Introduction](#introduction) * 3 [Terminology](#terminology) @@ -11681,6 +12235,9 @@ * 5.19.2 [RQ.SRS-006.RBAC.Select.Column](#rqsrs-006rbacselectcolumn) * 5.19.3 [RQ.SRS-006.RBAC.Select.Cluster](#rqsrs-006rbacselectcluster) * 5.19.4 [RQ.SRS-006.RBAC.Select.TableEngines](#rqsrs-006rbacselecttableengines) + * 5.19.5 [Table Functions](#table-functions) + * 5.19.5.1 [RQ.SRS-006.RBAC.Select.TableFunctions.Remote](#rqsrs-006rbacselecttablefunctionsremote) + * 5.19.5.2 [RQ.SRS-006.RBAC.Select.TableFunctions.Cluster](#rqsrs-006rbacselecttablefunctionscluster) * 5.20 [Insert](#insert) * 5.20.1 [RQ.SRS-006.RBAC.Insert](#rqsrs-006rbacinsert) * 5.20.2 [RQ.SRS-006.RBAC.Insert.Column](#rqsrs-006rbacinsertcolumn) @@ -11743,20 +12300,33 @@ * 5.21.10.2 [RQ.SRS-006.RBAC.Privileges.AlterMove.Grant](#rqsrs-006rbacprivilegesaltermovegrant) * 5.21.10.3 [RQ.SRS-006.RBAC.Privileges.AlterMove.Revoke](#rqsrs-006rbacprivilegesaltermoverevoke) * 5.21.10.4 [RQ.SRS-006.RBAC.Privileges.AlterMove.TableEngines](#rqsrs-006rbacprivilegesaltermovetableengines) + * 5.21.11 [Alter Projection](#alter-projection) + * 5.21.11.1 [RQ.SRS-006.RBAC.Privileges.AlterProjection](#rqsrs-006rbacprivilegesalterprojection) + * 5.21.11.2 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Add](#rqsrs-006rbacprivilegesalterprojectionadd) + * 5.21.11.3 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Drop](#rqsrs-006rbacprivilegesalterprojectiondrop) + * 5.21.11.4 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Materialize](#rqsrs-006rbacprivilegesalterprojectionmaterialize) + * 5.21.11.5 [RQ.SRS-006.RBAC.Privileges.AlterProjection.Clear](#rqsrs-006rbacprivilegesalterprojectionclear) + * 5.21.12 [Alter Database](#alter-database) + * 5.21.12.1 [RQ.SRS-006.RBAC.Privileges.AlterDatabase](#rqsrs-006rbacprivilegesalterdatabase) + * 5.21.12.2 [RQ.SRS-006.RBAC.Privileges.AlterDatabase.Settings](#rqsrs-006rbacprivilegesalterdatabasesettings) * 5.22 [Create](#create) - * 5.22.1 [RQ.SRS-006.RBAC.Privileges.CreateTable](#rqsrs-006rbacprivilegescreatetable) - * 5.22.2 [RQ.SRS-006.RBAC.Privileges.CreateDatabase](#rqsrs-006rbacprivilegescreatedatabase) - * 5.22.3 [RQ.SRS-006.RBAC.Privileges.CreateDictionary](#rqsrs-006rbacprivilegescreatedictionary) - * 5.22.4 [RQ.SRS-006.RBAC.Privileges.CreateTemporaryTable](#rqsrs-006rbacprivilegescreatetemporarytable) + * 5.22.1 [RQ.SRS-006.RBAC.Privileges.Create](#rqsrs-006rbacprivilegescreate) + * 5.22.2 [RQ.SRS-006.RBAC.Privileges.CreateTable](#rqsrs-006rbacprivilegescreatetable) + * 5.22.3 [RQ.SRS-006.RBAC.Privileges.CreateDatabase](#rqsrs-006rbacprivilegescreatedatabase) + * 5.22.4 [RQ.SRS-006.RBAC.Privileges.CreateDictionary](#rqsrs-006rbacprivilegescreatedictionary) + * 5.22.5 [RQ.SRS-006.RBAC.Privileges.CreateTemporaryTable](#rqsrs-006rbacprivilegescreatetemporarytable) + * 5.22.6 [RQ.SRS-006.RBAC.Privileges.CreateFunction](#rqsrs-006rbacprivilegescreatefunction) * 5.23 [Attach](#attach) * 5.23.1 [RQ.SRS-006.RBAC.Privileges.AttachDatabase](#rqsrs-006rbacprivilegesattachdatabase) * 5.23.2 [RQ.SRS-006.RBAC.Privileges.AttachDictionary](#rqsrs-006rbacprivilegesattachdictionary) * 5.23.3 [RQ.SRS-006.RBAC.Privileges.AttachTemporaryTable](#rqsrs-006rbacprivilegesattachtemporarytable) * 5.23.4 [RQ.SRS-006.RBAC.Privileges.AttachTable](#rqsrs-006rbacprivilegesattachtable) * 5.24 [Drop](#drop) - * 5.24.1 [RQ.SRS-006.RBAC.Privileges.DropTable](#rqsrs-006rbacprivilegesdroptable) - * 5.24.2 [RQ.SRS-006.RBAC.Privileges.DropDatabase](#rqsrs-006rbacprivilegesdropdatabase) - * 5.24.3 [RQ.SRS-006.RBAC.Privileges.DropDictionary](#rqsrs-006rbacprivilegesdropdictionary) + * 5.24.1 [RQ.SRS-006.RBAC.Privileges.Drop](#rqsrs-006rbacprivilegesdrop) + * 5.24.2 [RQ.SRS-006.RBAC.Privileges.DropTable](#rqsrs-006rbacprivilegesdroptable) + * 5.24.3 [RQ.SRS-006.RBAC.Privileges.DropDatabase](#rqsrs-006rbacprivilegesdropdatabase) + * 5.24.4 [RQ.SRS-006.RBAC.Privileges.DropDictionary](#rqsrs-006rbacprivilegesdropdictionary) + * 5.24.5 [RQ.SRS-006.RBAC.Privileges.DropFunction](#rqsrs-006rbacprivilegesdropfunction) * 5.25 [Detach](#detach) * 5.25.1 [RQ.SRS-006.RBAC.Privileges.DetachTable](#rqsrs-006rbacprivilegesdetachtable) * 5.25.2 [RQ.SRS-006.RBAC.Privileges.DetachView](#rqsrs-006rbacprivilegesdetachview) @@ -11834,32 +12404,41 @@ * 5.33 [Introspection](#introspection) * 5.33.1 [RQ.SRS-006.RBAC.Privileges.Introspection](#rqsrs-006rbacprivilegesintrospection) * 5.33.2 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToLine](#rqsrs-006rbacprivilegesintrospectionaddresstoline) - * 5.33.3 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol](#rqsrs-006rbacprivilegesintrospectionaddresstosymbol) - * 5.33.4 [RQ.SRS-006.RBAC.Privileges.Introspection.demangle](#rqsrs-006rbacprivilegesintrospectiondemangle) + * 5.33.3 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToLineWithInlines](#rqsrs-006rbacprivilegesintrospectionaddresstolinewithinlines) + * 5.33.4 [RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol](#rqsrs-006rbacprivilegesintrospectionaddresstosymbol) + * 5.33.5 [RQ.SRS-006.RBAC.Privileges.Introspection.demangle](#rqsrs-006rbacprivilegesintrospectiondemangle) * 5.34 [System](#system) * 5.34.1 [RQ.SRS-006.RBAC.Privileges.System.Shutdown](#rqsrs-006rbacprivilegessystemshutdown) * 5.34.2 [RQ.SRS-006.RBAC.Privileges.System.DropCache](#rqsrs-006rbacprivilegessystemdropcache) * 5.34.3 [RQ.SRS-006.RBAC.Privileges.System.DropCache.DNS](#rqsrs-006rbacprivilegessystemdropcachedns) * 5.34.4 [RQ.SRS-006.RBAC.Privileges.System.DropCache.Mark](#rqsrs-006rbacprivilegessystemdropcachemark) * 5.34.5 [RQ.SRS-006.RBAC.Privileges.System.DropCache.Uncompressed](#rqsrs-006rbacprivilegessystemdropcacheuncompressed) - * 5.34.6 [RQ.SRS-006.RBAC.Privileges.System.Reload](#rqsrs-006rbacprivilegessystemreload) - * 5.34.7 [RQ.SRS-006.RBAC.Privileges.System.Reload.Config](#rqsrs-006rbacprivilegessystemreloadconfig) - * 5.34.8 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionary](#rqsrs-006rbacprivilegessystemreloaddictionary) - * 5.34.9 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionaries](#rqsrs-006rbacprivilegessystemreloaddictionaries) - * 5.34.10 [RQ.SRS-006.RBAC.Privileges.System.Reload.EmbeddedDictionaries](#rqsrs-006rbacprivilegessystemreloadembeddeddictionaries) - * 5.34.11 [RQ.SRS-006.RBAC.Privileges.System.Merges](#rqsrs-006rbacprivilegessystemmerges) - * 5.34.12 [RQ.SRS-006.RBAC.Privileges.System.TTLMerges](#rqsrs-006rbacprivilegessystemttlmerges) - * 5.34.13 [RQ.SRS-006.RBAC.Privileges.System.Fetches](#rqsrs-006rbacprivilegessystemfetches) - * 5.34.14 [RQ.SRS-006.RBAC.Privileges.System.Moves](#rqsrs-006rbacprivilegessystemmoves) - * 5.34.15 [RQ.SRS-006.RBAC.Privileges.System.Sends](#rqsrs-006rbacprivilegessystemsends) - * 5.34.16 [RQ.SRS-006.RBAC.Privileges.System.Sends.Distributed](#rqsrs-006rbacprivilegessystemsendsdistributed) - * 5.34.17 [RQ.SRS-006.RBAC.Privileges.System.Sends.Replicated](#rqsrs-006rbacprivilegessystemsendsreplicated) - * 5.34.18 [RQ.SRS-006.RBAC.Privileges.System.ReplicationQueues](#rqsrs-006rbacprivilegessystemreplicationqueues) - * 5.34.19 [RQ.SRS-006.RBAC.Privileges.System.SyncReplica](#rqsrs-006rbacprivilegessystemsyncreplica) - * 5.34.20 [RQ.SRS-006.RBAC.Privileges.System.RestartReplica](#rqsrs-006rbacprivilegessystemrestartreplica) - * 5.34.21 [RQ.SRS-006.RBAC.Privileges.System.Flush](#rqsrs-006rbacprivilegessystemflush) - * 5.34.22 [RQ.SRS-006.RBAC.Privileges.System.Flush.Distributed](#rqsrs-006rbacprivilegessystemflushdistributed) - * 5.34.23 [RQ.SRS-006.RBAC.Privileges.System.Flush.Logs](#rqsrs-006rbacprivilegessystemflushlogs) + * 5.34.6 [RQ.SRS-006.RBAC.Privileges.System.DropCache.Mmap](#rqsrs-006rbacprivilegessystemdropcachemmap) + * 5.34.7 [RQ.SRS-006.RBAC.Privileges.System.DropCache.CompiledExpression](#rqsrs-006rbacprivilegessystemdropcachecompiledexpression) + * 5.34.8 [RQ.SRS-006.RBAC.Privileges.System.Reload](#rqsrs-006rbacprivilegessystemreload) + * 5.34.9 [RQ.SRS-006.RBAC.Privileges.System.Reload.Config](#rqsrs-006rbacprivilegessystemreloadconfig) + * 5.34.10 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionary](#rqsrs-006rbacprivilegessystemreloaddictionary) + * 5.34.11 [RQ.SRS-006.RBAC.Privileges.System.Reload.Dictionaries](#rqsrs-006rbacprivilegessystemreloaddictionaries) + * 5.34.12 [RQ.SRS-006.RBAC.Privileges.System.Reload.EmbeddedDictionaries](#rqsrs-006rbacprivilegessystemreloadembeddeddictionaries) + * 5.34.13 [RQ.SRS-006.RBAC.Privileges.System.Reload.Symbols](#rqsrs-006rbacprivilegessystemreloadsymbols) + * 5.34.14 [RQ.SRS-006.RBAC.Privileges.System.Reload.Function](#rqsrs-006rbacprivilegessystemreloadfunction) + * 5.34.15 [RQ.SRS-006.RBAC.Privileges.System.RestartDisk](#rqsrs-006rbacprivilegessystemrestartdisk) + * 5.34.16 [RQ.SRS-006.RBAC.Privileges.System.ThreadFuzzer](#rqsrs-006rbacprivilegessystemthreadfuzzer) + * 5.34.17 [RQ.SRS-006.RBAC.Privileges.System.Merges](#rqsrs-006rbacprivilegessystemmerges) + * 5.34.18 [RQ.SRS-006.RBAC.Privileges.System.TTLMerges](#rqsrs-006rbacprivilegessystemttlmerges) + * 5.34.19 [RQ.SRS-006.RBAC.Privileges.System.Fetches](#rqsrs-006rbacprivilegessystemfetches) + * 5.34.20 [RQ.SRS-006.RBAC.Privileges.System.Moves](#rqsrs-006rbacprivilegessystemmoves) + * 5.34.21 [RQ.SRS-006.RBAC.Privileges.System.Sends](#rqsrs-006rbacprivilegessystemsends) + * 5.34.22 [RQ.SRS-006.RBAC.Privileges.System.Sends.Distributed](#rqsrs-006rbacprivilegessystemsendsdistributed) + * 5.34.23 [RQ.SRS-006.RBAC.Privileges.System.Sends.Replicated](#rqsrs-006rbacprivilegessystemsendsreplicated) + * 5.34.24 [RQ.SRS-006.RBAC.Privileges.System.ReplicationQueues](#rqsrs-006rbacprivilegessystemreplicationqueues) + * 5.34.25 [RQ.SRS-006.RBAC.Privileges.System.SyncReplica](#rqsrs-006rbacprivilegessystemsyncreplica) + * 5.34.26 [RQ.SRS-006.RBAC.Privileges.System.RestartReplica](#rqsrs-006rbacprivilegessystemrestartreplica) + * 5.34.27 [RQ.SRS-006.RBAC.Privileges.System.DropReplica](#rqsrs-006rbacprivilegessystemdropreplica) + * 5.34.28 [RQ.SRS-006.RBAC.Privileges.System.RestoreReplica](#rqsrs-006rbacprivilegessystemrestorereplica) + * 5.34.29 [RQ.SRS-006.RBAC.Privileges.System.Flush](#rqsrs-006rbacprivilegessystemflush) + * 5.34.30 [RQ.SRS-006.RBAC.Privileges.System.Flush.Distributed](#rqsrs-006rbacprivilegessystemflushdistributed) + * 5.34.31 [RQ.SRS-006.RBAC.Privileges.System.Flush.Logs](#rqsrs-006rbacprivilegessystemflushlogs) * 5.35 [Sources](#sources) * 5.35.1 [RQ.SRS-006.RBAC.Privileges.Sources](#rqsrs-006rbacprivilegessources) * 5.35.2 [RQ.SRS-006.RBAC.Privileges.Sources.File](#rqsrs-006rbacprivilegessourcesfile) @@ -11870,6 +12449,9 @@ * 5.35.7 [RQ.SRS-006.RBAC.Privileges.Sources.JDBC](#rqsrs-006rbacprivilegessourcesjdbc) * 5.35.8 [RQ.SRS-006.RBAC.Privileges.Sources.HDFS](#rqsrs-006rbacprivilegessourceshdfs) * 5.35.9 [RQ.SRS-006.RBAC.Privileges.Sources.S3](#rqsrs-006rbacprivilegessourcess3) + * 5.35.10 [RQ.SRS-006.RBAC.Privileges.Sources.Mongo](#rqsrs-006rbacprivilegessourcesmongo) + * 5.35.11 [RQ.SRS-006.RBAC.Privileges.Sources.Postgres](#rqsrs-006rbacprivilegessourcespostgres) + * 5.35.12 [RQ.SRS-006.RBAC.Privileges.Sources.Sqlite](#rqsrs-006rbacprivilegessourcessqlite) * 5.36 [RQ.SRS-006.RBAC.Privileges.GrantOption](#rqsrs-006rbacprivilegesgrantoption) * 5.37 [RQ.SRS-006.RBAC.Privileges.All](#rqsrs-006rbacprivilegesall) * 5.38 [RQ.SRS-006.RBAC.Privileges.RoleAll](#rqsrs-006rbacprivilegesroleall) @@ -14506,6 +15088,21 @@ * ReplicatedVersionedCollapsingMergeTree * ReplicatedGraphiteMergeTree +#### Table Functions + +##### RQ.SRS-006.RBAC.Select.TableFunctions.Remote +version: 1.0 + +[ClickHouse] SHALL only execute `SELECT FROM remote()` query if +the user has **REMOTE**, **CREATE TEMPORARY TABLE** and **SELECT** privileges. + + +##### RQ.SRS-006.RBAC.Select.TableFunctions.Cluster +version: 1.0 + +[ClickHouse] SHALL only execute `SELECT FROM cluster()` query if +the user has **REMOTE**, **CREATE TEMPORARY TABLE** and **SELECT** privileges. + ### Insert #### RQ.SRS-006.RBAC.Insert @@ -14562,7 +15159,7 @@ [ClickHouse] SHALL support controlling access to the **alter column** privilege for a database or a specific table to one or more **users** or **roles**. -Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` statements SHALL +Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL return an error, unless the user has the **alter column** privilege for the destination table either because of the explicit grant or through one of the roles assigned to the user. @@ -14584,7 +15181,7 @@ [ClickHouse] SHALL support granting or revoking **alter column** privilege for one or more specified columns in a table to one or more **users** or **roles**. -Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` statements SHALL return an error, +Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL return an error, unless the user has the **alter column** privilege for the destination column either because of the explicit grant or through one of the roles assigned to the user. @@ -14593,7 +15190,7 @@ [ClickHouse] SHALL support granting or revoking **alter column** privilege on a specified cluster to one or more **users** or **roles**. -Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY COLUMN` +Any `ALTER TABLE ... ADD|DROP|CLEAR|COMMENT|MODIFY|MATERIALIZE COLUMN` statements SHALL succeed only on nodes where the table exists and privilege was granted. ##### RQ.SRS-006.RBAC.Privileges.AlterColumn.TableEngines @@ -15019,8 +15616,61 @@ * ReplicatedVersionedCollapsingMergeTree * ReplicatedGraphiteMergeTree +#### Alter Projection + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER PROJECTION` privilege, +which permits users to **add**, **drop**, **materialize**, and **clear** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Add +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER ADD PROJECTION` privilege, +which permits users to **add** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Drop +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER DROP PROJECTION` privilege, +which permits users to **drop** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Materialize +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER MATERIALIZE PROJECTION` privilege, +which permits users to **materialize** projections. + +##### RQ.SRS-006.RBAC.Privileges.AlterProjection.Clear +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER CLEAR PROJECTION` privilege, +which permits users to **clear** projections. + +#### Alter Database + +##### RQ.SRS-006.RBAC.Privileges.AlterDatabase +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER DATABASE` privilege, +which permits users to **alter** a database. + +##### RQ.SRS-006.RBAC.Privileges.AlterDatabase.Settings +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `ALTER DATABASE SETTINGS` privilege, +which permits users to **alter** the settings of a database. + ### Create +#### RQ.SRS-006.RBAC.Privileges.Create +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `CREATE` privilege, +which permits users to **create** tables, databases, dictionaries, and temporary tables. +This privilege does NOT grant the permission to create users, roles, or quotas, row policies, or settings profiles. + #### RQ.SRS-006.RBAC.Privileges.CreateTable version: 1.0 @@ -15057,6 +15707,12 @@ [ClickHouse] SHALL successfully execute `CREATE TEMPORARY TABLE` statement if and only if the user has **create temporary table** privilege on the table, either directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.CreateFunction +version: 1.0 + +[ClickHouse] SHALL successfully execute `CREATE FUNCTION` statement if and only if the user has **create function** privilege, +either directly or through a role. + ### Attach #### RQ.SRS-006.RBAC.Privileges.AttachDatabase @@ -15085,6 +15741,13 @@ ### Drop +#### RQ.SRS-006.RBAC.Privileges.Drop +version: 1.0 + +[ClickHouse] SHALL support granting and revoking `DROP` privilege, +which permits users to **drop** tables, databases, dictionaries, and temporary tables. +This privilege does NOT grant the permission to create users, roles, or quotas, row policies, or settings profiles. + #### RQ.SRS-006.RBAC.Privileges.DropTable version: 1.0 @@ -15103,6 +15766,12 @@ [ClickHouse] SHALL successfully execute `DROP DICTIONARY` statement if and only if the user has **drop dictionary** privilege on the dictionary, either directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.DropFunction +version: 1.0 + +[ClickHouse] SHALL successfully execute `DROP FUNCTION` statement if and only if the user has **drop function** privilege, +either directly or through a role. + ### Detach #### RQ.SRS-006.RBAC.Privileges.DetachTable @@ -15542,6 +16211,12 @@ [ClickHouse] SHALL successfully execute `addressToLine` statement if and only if the user has **introspection** privilege, either directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.Introspection.addressToLineWithInlines +version: 1.0 + +[ClickHouse] SHALL successfully execute `addressToLineWithInlines` statement if and only if +the user has **introspection** privilege, either directly or through a role. + #### RQ.SRS-006.RBAC.Privileges.Introspection.addressToSymbol version: 1.0 @@ -15589,6 +16264,20 @@ the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP UNCOMPRESSED CACHE`, `SYSTEM DROP UNCOMPRESSED`, `DROP UNCOMPRESSED CACHE`, or `DROP UNCOMPRESSED`. +#### RQ.SRS-006.RBAC.Privileges.System.DropCache.Mmap +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM DROP MMAP CACHE` privilege when +the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP MMAP CACHE`, +`SYSTEM DROP MMAP`, `DROP MMAP CACHE`, or `DROP MMAP`. + +#### RQ.SRS-006.RBAC.Privileges.System.DropCache.CompiledExpression +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM DROP COMPILED EXPRESSION CACHE` privilege when +the user is granted `SYSTEM`, `SYSTEM DROP CACHE`, `DROP CACHE`, `SYSTEM DROP COMPILED EXPRESSION CACHE`, +`SYSTEM DROP COMPILED EXPRESSION`, or `DROP COMPILED EXPRESSION CACHE` + #### RQ.SRS-006.RBAC.Privileges.System.Reload version: 1.0 @@ -15619,6 +16308,30 @@ [ClickHouse] SHALL successfully grant `SYSTEM RELOAD EMBEDDED DICTIONARIES` privilege when the user is granted `SYSTEM`, `SYSTEM RELOAD`, `SYSTEM RELOAD DICTIONARY ON *.*`, or `SYSTEM RELOAD EMBEDDED DICTIONARIES`. +#### RQ.SRS-006.RBAC.Privileges.System.Reload.Symbols +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RELOAD SYMBOLS` privilege when +the user is granted `SYSTEM`, `SYSTEM RELOAD`, or `SYSTEM RELOAD SYMBOLS`. + +#### RQ.SRS-006.RBAC.Privileges.System.Reload.Function +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RELOAD FUNCTION` privilege when +the user is granted `SYSTEM`, `SYSTEM RELOAD`, or `SYSTEM RELOAD FUNCTION`. + +#### RQ.SRS-006.RBAC.Privileges.System.RestartDisk +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RESTART DISK` privilege when +the user is granted `SYSTEM RESTART DISK`. + +#### RQ.SRS-006.RBAC.Privileges.System.ThreadFuzzer +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM THREAD FUZZER` privilege when +the user is granted `SYSTEM THREAD FUZZER`. + #### RQ.SRS-006.RBAC.Privileges.System.Merges version: 1.0 @@ -15682,6 +16395,18 @@ [ClickHouse] SHALL successfully grant `SYSTEM RESTART REPLICA` privilege when the user is granted `SYSTEM`, `SYSTEM RESTART REPLICA`, or `RESTART REPLICA`. +#### RQ.SRS-006.RBAC.Privileges.System.DropReplica +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM DROP REPLICA` privilege when +the user is granted `SYSTEM`, `SYSTEM DROP REPLICA`, or `DROP REPLICA`. + +#### RQ.SRS-006.RBAC.Privileges.System.RestoreReplica +version: 1.0 + +[ClickHouse] SHALL successfully grant `SYSTEM RESTORE REPLICA` privilege when +the user is granted `SYSTEM`, `SYSTEM RESTORE REPLICA`, or `RESTORE REPLICA`. + #### RQ.SRS-006.RBAC.Privileges.System.Flush version: 1.0 @@ -15756,6 +16481,24 @@ [ClickHouse] SHALL support the use of `S3` source by a user if and only if the user has `S3` or `SOURCES` privileges granted to them directly or through a role. +#### RQ.SRS-006.RBAC.Privileges.Sources.Mongo +version: 1.0 + +[ClickHouse] SHALL support the use of `MONGO` source by a user if and only if +the user has `MONGO` or `SOURCES` privileges granted to them directly or through a role. + +#### RQ.SRS-006.RBAC.Privileges.Sources.Postgres +version: 1.0 + +[ClickHouse] SHALL support the use of `POSTGRES` source by a user if and only if +the user has `POSTGRES` or `SOURCES` privileges granted to them directly or through a role. + +#### RQ.SRS-006.RBAC.Privileges.Sources.Sqlite +version: 1.0 + +[ClickHouse] SHALL support the use of `SQLITE` source by a user if and only if +the user has `SQLITE` or `SOURCES` privileges granted to them directly or through a role. + ### RQ.SRS-006.RBAC.Privileges.GrantOption version: 1.0 diff --git a/tests/testflows/rbac/tests/privileges/alter/alter_database.py b/tests/testflows/rbac/tests/privileges/alter/alter_database.py new file mode 100644 index 00000000000..208b29b95aa --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/alter/alter_database.py @@ -0,0 +1,144 @@ +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privilege_granted_directly_or_via_role(self, node=None): + """Check that user is only able to execute ALTER DATABASE when they have required privilege, either directly or via role.""" + role_name = f"role_{getuid()}" + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with Suite("user with direct privilege"): + with user(node, user_name): + + with When( + f"I run checks that {user_name} is only able to execute ALTER DATABASE with required privileges" + ): + privilege_check( + grant_target_name=user_name, user_name=user_name, node=node + ) + + with Suite("user with privilege via role"): + with user(node, user_name), role(node, role_name): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + with And( + f"I run checks that {user_name} with {role_name} is only able to execute ALTER DATABASE with required privileges" + ): + privilege_check( + grant_target_name=role_name, user_name=user_name, node=node + ) + + +def privilege_check(grant_target_name, user_name, node=None): + """Run scenarios to check the user's access with different privileges.""" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + + with Scenario("user without privilege"): + db_name = f"db_{getuid()}" + + try: + with Given("I have a database"): + node.query(f"CREATE DATABASE {db_name}") + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I attempt to alter a database"): + node.query( + f"ALTER DATABASE {db_name} MODIFY SETTING engine='Lazy'", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + finally: + with Finally("I drop the database"): + node.query(f"DROP DATABASE IF EXISTS {db_name}") + + with Scenario("user with privilege"): + db_name = f"db_{getuid()}" + + try: + with Given("I have a database"): + node.query(f"CREATE DATABASE {db_name}") + + with When(f"I grant {current().context.privilege} privilege"): + node.query( + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" + ) + + with Then("I attempt to alter a database"): + node.query( + f"ALTER DATABASE {db_name} MODIFY SETTING engine='Lazy'", + settings=[("user", user_name)], + exitcode=48, + message="DB::Exception: Database engine Atomic either does not support settings", + ) + + finally: + with Finally("I drop the database"): + node.query(f"DROP DATABASE IF EXISTS {db_name}") + + with Scenario("user with revoked privilege"): + db_name = f"db_{getuid()}" + + try: + with Given("I have a database"): + node.query(f"CREATE DATABASE {db_name}") + + with When(f"I grant the {current().context.privilege} privilege"): + node.query( + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" + ) + + with And(f"I revoke the {current().context.privilege} privilege"): + node.query( + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" + ) + + with Then("I attempt to alter a database"): + node.query( + f"ALTER DATABASE {db_name} MODIFY SETTING engine='Lazy'", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + finally: + with Finally("I drop the database"): + node.query(f"DROP DATABASE IF EXISTS {db_name}") + + +@TestFeature +@Requirements( + RQ_SRS_006_RBAC_Privileges_AlterDatabase("1.0"), + RQ_SRS_006_RBAC_Privileges_AlterDatabase_Settings("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_None("1.0"), +) +@Name("alter database") +def feature(self, node="clickhouse1", stress=None, parallel=None): + """Check the RBAC functionality of ALTER DATABASE.""" + self.context.node = self.context.cluster.node(node) + + if parallel is not None: + self.context.parallel = parallel + if stress is not None: + self.context.stress = stress + + for current().context.privilege in ["ALL", "ALTER DATABASE", "ALTER"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/create/create_database.py b/tests/testflows/rbac/tests/privileges/create/create_database.py index 8a8b71b19a3..dbe983ae4c2 100644 --- a/tests/testflows/rbac/tests/privileges/create/create_database.py +++ b/tests/testflows/rbac/tests/privileges/create/create_database.py @@ -66,9 +66,9 @@ def privilege_check(grant_target_name, user_name, node=None): db_name = f"db_{getuid()}" try: - with When("I grant create database privilege"): + with When(f"I grant {current().context.privilege} privilege"): node.query( - f"GRANT CREATE DATABASE ON {db_name}.* TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) with Then("I attempt to create a database"): @@ -82,14 +82,14 @@ def privilege_check(grant_target_name, user_name, node=None): db_name = f"db_{getuid()}" try: - with When("I grant the create database privilege"): + with When(f"I grant the {current().context.privilege} privilege"): node.query( - f"GRANT CREATE DATABASE ON {db_name}.* TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) - with And("I revoke the create database privilege"): + with And(f"I revoke the {current().context.privilege} privilege"): node.query( - f"REVOKE CREATE DATABASE ON {db_name}.* FROM {grant_target_name}" + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" ) with Then("I attempt to create a database"): @@ -104,44 +104,6 @@ def privilege_check(grant_target_name, user_name, node=None): with Finally("I drop the database"): node.query(f"DROP DATABASE IF EXISTS {db_name}") - with Scenario("user with revoked ALL privilege"): - db_name = f"db_{getuid()}" - - try: - with When("I grant the create database privilege"): - node.query( - f"GRANT CREATE DATABASE ON {db_name}.* TO {grant_target_name}" - ) - - with And("I revoke ALL privilege"): - node.query(f"REVOKE ALL ON *.* FROM {grant_target_name}") - - with Then("I attempt to create a database"): - node.query( - f"CREATE DATABASE {db_name}", - settings=[("user", user_name)], - exitcode=exitcode, - message=message, - ) - - finally: - with Finally("I drop the database"): - node.query(f"DROP DATABASE IF EXISTS {db_name}") - - with Scenario("user with ALL privilege"): - db_name = f"db_{getuid()}" - - try: - with When("I grant ALL privilege"): - node.query(f"GRANT ALL ON *.* TO {grant_target_name}") - - with Then("I attempt to create a database"): - node.query(f"CREATE DATABASE {db_name}", settings=[("user", user_name)]) - - finally: - with Finally("I drop the database"): - node.query(f"DROP DATABASE IF EXISTS {db_name}") - @TestFeature @Requirements( @@ -159,8 +121,10 @@ def feature(self, node="clickhouse1", stress=None, parallel=None): if stress is not None: self.context.stress = stress - with Suite( - test=privilege_granted_directly_or_via_role, - setup=instrument_clickhouse_server_log, - ): - privilege_granted_directly_or_via_role() + for current().context.privilege in ["ALL", "CREATE", "CREATE DATABASE"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/create/create_dictionary.py b/tests/testflows/rbac/tests/privileges/create/create_dictionary.py index 76125aa0239..4ab52ec8177 100644 --- a/tests/testflows/rbac/tests/privileges/create/create_dictionary.py +++ b/tests/testflows/rbac/tests/privileges/create/create_dictionary.py @@ -66,9 +66,9 @@ def privilege_check(grant_target_name, user_name, node=None): dict_name = f"dict_{getuid()}" try: - with When("I grant create dictionary privilege"): + with When(f"I grant the {current().context.privilege} privilege"): node.query( - f"GRANT CREATE DICTIONARY ON {dict_name} TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) with Then("I attempt to create a dictionary"): @@ -85,14 +85,14 @@ def privilege_check(grant_target_name, user_name, node=None): dict_name = f"dict_{getuid()}" try: - with When("I grant the create dictionary privilege"): + with When(f"I grant the {current().context.privilege} privilege"): node.query( - f"GRANT CREATE DICTIONARY ON {dict_name} TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) - with And("I revoke the create dictionary privilege"): + with And(f"I revoke the {current().context.privilege} privilege"): node.query( - f"REVOKE CREATE DICTIONARY ON {dict_name} FROM {grant_target_name}" + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" ) with Then("I attempt to create a dictionary"): @@ -107,47 +107,6 @@ def privilege_check(grant_target_name, user_name, node=None): with Finally("I drop the dictionary"): node.query(f"DROP DICTIONARY IF EXISTS {dict_name}") - with Scenario("user with revoked ALL privilege"): - dict_name = f"dict_{getuid()}" - - try: - with When("I grant the create dictionary privilege"): - node.query( - f"GRANT CREATE DICTIONARY ON {dict_name} TO {grant_target_name}" - ) - - with And("I revoke ALL privilege"): - node.query(f"REVOKE ALL ON *.* FROM {grant_target_name}") - - with Then("I attempt to create a dictionary"): - node.query( - f"CREATE DICTIONARY {dict_name}(x Int32, y Int32) PRIMARY KEY x LAYOUT(FLAT()) SOURCE(CLICKHOUSE()) LIFETIME(0)", - settings=[("user", user_name)], - exitcode=exitcode, - message=message, - ) - - finally: - with Finally("I drop the dictionary"): - node.query(f"DROP DICTIONARY IF EXISTS {dict_name}") - - with Scenario("user with ALL privilege"): - dict_name = f"dict_{getuid()}" - - try: - with When("I grant ALL privilege"): - node.query(f"GRANT ALL ON *.* TO {grant_target_name}") - - with Then("I attempt to create a dictionary"): - node.query( - f"CREATE DICTIONARY {dict_name}(x Int32, y Int32) PRIMARY KEY x LAYOUT(FLAT()) SOURCE(CLICKHOUSE()) LIFETIME(0)", - settings=[("user", user_name)], - ) - - finally: - with Finally("I drop the dictionary"): - node.query(f"DROP DICTIONARY IF EXISTS {dict_name}") - @TestFeature @Requirements( @@ -165,8 +124,10 @@ def feature(self, node="clickhouse1", stress=None, parallel=None): if stress is not None: self.context.stress = stress - with Suite( - test=privilege_granted_directly_or_via_role, - setup=instrument_clickhouse_server_log, - ): - privilege_granted_directly_or_via_role() + for current().context.privilege in ["ALL", "CREATE", "CREATE DICTIONARY"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/create/create_function.py b/tests/testflows/rbac/tests/privileges/create/create_function.py new file mode 100644 index 00000000000..c2f27448203 --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/create/create_function.py @@ -0,0 +1,134 @@ +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privilege_granted_directly_or_via_role(self, node=None): + """Check that user is only able to execute CREATE FUNCTION when they have required privilege, either directly or via role.""" + role_name = f"role_{getuid()}" + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with Suite("user with direct privilege"): + with user(node, user_name): + + with When( + f"I run checks that {user_name} is only able to execute CREATE FUNCTION with required privileges" + ): + privilege_check( + grant_target_name=user_name, user_name=user_name, node=node + ) + + with Suite("user with privilege via role"): + with user(node, user_name), role(node, role_name): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + with And( + f"I run checks that {user_name} with {role_name} is only able to execute CREATE DICTIONARY with required privileges" + ): + privilege_check( + grant_target_name=role_name, user_name=user_name, node=node + ) + + +def privilege_check(grant_target_name, user_name, node=None): + """Run scenarios to check the user's access with different privileges.""" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + + with Scenario("user without privilege"): + func_name = f"dict_{getuid()}" + + try: + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I attempt to create a FUNCTION without privilege"): + node.query( + f"CREATE FUNCTION {func_name} AS (x) -> 2*x;", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + finally: + with Finally("I drop the function"): + node.query(f"DROP FUNCTION IF EXISTS {func_name}") + + with Scenario("user with privilege"): + func_name = f"dict_{getuid()}" + + try: + with When(f"I grant the {current().context.privilege} privilege"): + node.query( + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" + ) + + with Then("I attempt to create a function"): + node.query( + f"CREATE FUNCTION {func_name} AS (x) -> 2*x;", + settings=[("user", user_name)], + ) + + finally: + with Finally("I drop the function"): + node.query(f"DROP FUNCTION IF EXISTS {func_name}") + + with Scenario("user with revoked privilege"): + func_name = f"dict_{getuid()}" + + try: + with When(f"I grant the {current().context.privilege} privilege"): + node.query( + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" + ) + + with And(f"I revoke the {current().context.privilege} privilege"): + node.query( + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" + ) + + with Then("I attempt to create a function"): + node.query( + f"CREATE FUNCTION {func_name} AS (x) -> 2*x;", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + finally: + with Finally("I drop the function"): + node.query(f"DROP FUNCTION IF EXISTS {func_name}") + + +@TestFeature +@Requirements( + RQ_SRS_006_RBAC_Privileges_CreateFunction("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_None("1.0"), + RQ_SRS_006_RBAC_Privileges_Create("1.0"), +) +@Name("create function") +def feature(self, node="clickhouse1", stress=None, parallel=None): + """Check the RBAC functionality of CREATE FUNCTION.""" + self.context.node = self.context.cluster.node(node) + + if parallel is not None: + self.context.parallel = parallel + if stress is not None: + self.context.stress = stress + + for current().context.privilege in ["ALL", "CREATE", "CREATE FUNCTION"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/create/create_row_policy.py b/tests/testflows/rbac/tests/privileges/create/create_row_policy.py index 81b9d093e7e..c419d7827ee 100644 --- a/tests/testflows/rbac/tests/privileges/create/create_row_policy.py +++ b/tests/testflows/rbac/tests/privileges/create/create_row_policy.py @@ -1206,6 +1206,227 @@ def dict(self, node=None): node.query(f"DROP TABLE IF EXISTS {table_name}") +@TestScenario +def remote(self, node=None): + """Check that row policies do not only allow access from the source node.""" + user_name = f"user_{getuid()}" + table_name = f"table_{getuid()}" + dist_table_name = f"dist_table_{getuid()}" + pol_name = f"pol_{getuid()}" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + + if node is None: + node = self.context.node + + node2 = self.context.cluster.node("clickhouse2") + node3 = self.context.cluster.node("clickhouse3") + + try: + with Given("I have a table on a cluster with two nodes on seperate shards"): + node.query( + f"CREATE TABLE {table_name} ON CLUSTER sharded_cluster12 (x UInt8) ENGINE=Memory" + ) + + with And("I have a distributed table"): + node.query( + f"CREATE TABLE {dist_table_name} ON CLUSTER sharded_cluster (x UInt8) ENGINE=Distributed(sharded_cluster12, default, {table_name})" + ) + + with And(f"I have a user {user_name} on three nodes on seperate shards"): + node.query(f"CREATE USER {user_name} ON CLUSTER sharded_cluster") + + with And("I have some data in the table on clickhouse1"): + node.query(f"INSERT INTO {table_name} VALUES (1),(2)") + + with And("I have a row policy on clickhouse1"): + node.query( + f"CREATE ROW POLICY {pol_name} ON {table_name} AS PERMISSIVE USING x=1 TO {user_name}" + ) + + with And( + f"The user {user_name} has SELECT privilege on {table_name} and {dist_table_name}" + ): + node.query( + f"GRANT SELECT ON default.{table_name} TO {user_name} ON CLUSTER sharded_cluster" + ) + node.query( + f"GRANT SELECT ON default.{dist_table_name} TO {user_name} ON CLUSTER sharded_cluster" + ) + + with When( + f"I select from the table as the user to set a baseline for comparison" + ): + expected = node.query( + f"SELECT * FROM {table_name}", settings=[("user", f"{user_name}")] + ).output + assert expected == "1", error() + + with Then(f"I compare it with SELECT from {dist_table_name}"): + output = node.query( + f"SELECT * FROM {dist_table_name}", settings=[("user", f"{user_name}")] + ).output + assert output == expected, error() + + with And( + "I grant CREATE TEMPORARY TABLE and cluster privileges to the user on all nodes" + ): + node.query( + f"GRANT CREATE TEMPORARY TABLE ON *.* TO {user_name} ON CLUSTER sharded_cluster" + ) + node.query(f"GRANT REMOTE ON *.* TO {user_name} ON CLUSTER sharded_cluster") + + with When(f"I select from the cluster table as {user_name}"): + output = node.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + settings=[("user", user_name)], + ).output + assert output == expected, error() + + with And(f"I select from the remote table as {user_name}"): + output = node.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + settings=[("user", user_name)], + ).output + assert output == expected, error() + + with And(f"I select from the cluster table as {user_name} from clickhouse2"): + output = node2.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + settings=[("user", user_name)], + ).output + assert output == expected, error() + + with And(f"I select from the remote table as {user_name} from clickhouse2"): + output = node2.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + settings=[("user", user_name)], + ).output + assert output == expected, error() + + with And(f"I SELECT from {dist_table_name} from clickhouse2"): + output = node2.query( + f"SELECT * FROM {dist_table_name}", settings=[("user", f"{user_name}")] + ).output + assert output == expected, error() + + with And(f"I select from the cluster table as {user_name} from clickhouse3"): + output = node3.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + settings=[("user", user_name)], + ).output + assert output == expected, error() + + with And(f"I select from the remote table as {user_name} from clickhouse3"): + output = node3.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + settings=[("user", user_name)], + ).output + assert output == expected, error() + + with And(f"I SELECT from {dist_table_name} from clickhouse3"): + output = node3.query( + f"SELECT * FROM {dist_table_name}", settings=[("user", f"{user_name}")] + ).output + assert output == expected, error() + + finally: + with Finally(f"I drop the table {table_name} from the cluster", flags=TE): + node.query( + f"DROP TABLE IF EXISTS {table_name} ON CLUSTER sharded_cluster12" + ) + + with And(f"I drop the table {dist_table_name} from the cluster", flags=TE): + node.query( + f"DROP TABLE IF EXISTS {dist_table_name} ON CLUSTER sharded_cluster" + ) + + with And(f"I drop the user {user_name} from the cluster", flags=TE): + node.query(f"DROP USER IF EXISTS {user_name} ON CLUSTER sharded_cluster") + + +@TestScenario +def postgresql(self): + """Check that row policies apply correctly to postgresql.""" + node = self.context.node + table_name = f"table_{getuid()}" + pol_name = f"pol_{getuid()}" + user_name = f"user_{getuid()}" + + try: + with Given("I have a table"): + node.query( + f"CREATE TABLE {table_name} (x UInt32) ENGINE=MergeTree ORDER BY x;" + ) + + with And("I have a user"): + node.query( + f"CREATE USER {user_name} IDENTIFIED WITH plaintext_password BY 'x'" + ) + + with And("The user has select privilege on the table."): + node.query(f"GRANT SELECT ON default.{table_name} TO {user_name}") + + with When("I insert into the table"): + node.query(f"INSERT INTO {table_name} SELECT * FROM numbers(10)") + + with And("I have a row policy"): + node.query( + f"CREATE ROW POLICY {pol_name} ON default.{table_name} FOR SELECT USING x = 2 TO {user_name}" + ) + + with Then("I select from table using postgress"): + psql_out = node.command( + f"PGPASSWORD=x psql -p 9005 -h 127.0.0.1 -U {user_name} default -c'SELECT * FROM {table_name}'" + ).output + assert psql_out == " x \n---\n 2\n(1 row)", error() + + finally: + with Finally("I drop the user"): + node.query(f"DROP USER IF EXISTS {user_name}") + + with And("I drop the table"): + node.query(f"DROP TABLE IF EXISTS {table_name}") + + +@TestScenario +def mysql(self): + """Check that row policies apply correctly to mysql.""" + node = self.context.node + table_name = f"table_{getuid()}" + pol_name = f"pol_{getuid()}" + user_name = f"user_{getuid()}" + + try: + with Given("I have a table"): + node.query( + f"CREATE TABLE {table_name} (x UInt32) ENGINE=MergeTree ORDER BY x;" + ) + + with When("I insert into the table"): + node.query(f"INSERT INTO {table_name} SELECT * FROM numbers(10)") + + with And("I have a row policy"): + node.query( + f"CREATE ROW POLICY {pol_name} ON default.{table_name} FOR SELECT USING x = 2 TO default" + ) + + with Then("I select from table using mysql"): + msql_out = ( + self.context.cluster.node("mysql1") + .command( + f"mysql -h clickhouse1 -P 9004 -D default -u default -e 'SELECT * FROM {table_name}'" + ) + .output + ) + assert ( + msql_out == "+------+\n| x |\n+------+\n| 2 |\n+------+" + ), error() + + finally: + with Finally("I drop the table"): + node.query(f"DROP TABLE IF EXISTS {table_name}") + + @TestFeature @Name("create row policy") @Requirements( @@ -1249,3 +1470,6 @@ def feature(self, node="clickhouse1"): Scenario(run=no_table, setup=instrument_clickhouse_server_log) Scenario(run=policy_before_table, setup=instrument_clickhouse_server_log) Scenario(run=dict, setup=instrument_clickhouse_server_log) + Scenario(run=remote, setup=instrument_clickhouse_server_log) + Scenario(run=postgresql, setup=instrument_clickhouse_server_log) + Scenario(run=mysql, setup=instrument_clickhouse_server_log) diff --git a/tests/testflows/rbac/tests/privileges/create/create_table.py b/tests/testflows/rbac/tests/privileges/create/create_table.py index 9d10d4fc9f0..bbb96fdf3dd 100644 --- a/tests/testflows/rbac/tests/privileges/create/create_table.py +++ b/tests/testflows/rbac/tests/privileges/create/create_table.py @@ -148,6 +148,59 @@ def create_with_all_privilege(self, grant_target_name, user_name, node=None): node.query(f"DROP TABLE IF EXISTS {table_name}") +@TestScenario +@Requirements(RQ_SRS_006_RBAC_Privileges_All("1.0")) +def create_with_create_privilege_granted_directly_or_via_role(self, node=None): + """Check that user is able to create a table with CREATE privilege, either granted directly or through a role.""" + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Scenario( + test=create_with_create_privilege, + name="create with CREATE privilege granted directly", + )(grant_target_name=user_name, user_name=user_name) + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Scenario( + test=create_with_create_privilege, + name="create with CREATE privilege granted through a role", + )(grant_target_name=role_name, user_name=user_name) + + +@TestOutline +def create_with_create_privilege(self, grant_target_name, user_name, node=None): + """Check that user is able to create a table with the CREATE privilege.""" + table_name = f"table_{getuid()}" + + if node is None: + node = self.context.node + try: + with Given("I don't have a table"): + node.query(f"DROP TABLE IF EXISTS {table_name}") + + with When("I grant CREATE privilege"): + node.query(f"GRANT CREATE ON *.* TO {grant_target_name}") + + with Then("I try to create a table without privilege as the user"): + node.query( + f"CREATE TABLE {table_name} (x Int8) ENGINE = Memory", + settings=[("user", f"{user_name}")], + ) + + finally: + with Then("I drop the table"): + node.query(f"DROP TABLE IF EXISTS {table_name}") + + @TestScenario def create_with_revoked_create_table_privilege_revoked_directly_or_from_role( self, node=None diff --git a/tests/testflows/rbac/tests/privileges/create/create_temp_table.py b/tests/testflows/rbac/tests/privileges/create/create_temp_table.py index 0cc3211bddf..b5d0e881abb 100644 --- a/tests/testflows/rbac/tests/privileges/create/create_temp_table.py +++ b/tests/testflows/rbac/tests/privileges/create/create_temp_table.py @@ -66,9 +66,9 @@ def privilege_check(grant_target_name, user_name, node=None): temp_table_name = f"temp_table_{getuid()}" try: - with When("I grant create temporary table privilege"): + with When(f"I grant the {current().context.privilege} privilege"): node.query( - f"GRANT CREATE TEMPORARY TABLE ON *.* TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) with Then("I attempt to create aa temporary table"): @@ -85,14 +85,14 @@ def privilege_check(grant_target_name, user_name, node=None): temp_table_name = f"temp_table_{getuid()}" try: - with When("I grant the create temporary table privilege"): + with When(f"I grant the {current().context.privilege} privilege"): node.query( - f"GRANT CREATE TEMPORARY TABLE ON *.* TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) - with And("I revoke the create temporary table privilege"): + with And(f"I revoke the {current().context.privilege} privilege"): node.query( - f"REVOKE CREATE TEMPORARY TABLE ON *.* FROM {grant_target_name}" + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" ) with Then("I attempt to create a temporary table"): @@ -107,47 +107,6 @@ def privilege_check(grant_target_name, user_name, node=None): with Finally("I drop the temporary table"): node.query(f"DROP TEMPORARY TABLE IF EXISTS {temp_table_name}") - with Scenario("user with revoked ALL privilege"): - temp_table_name = f"temp_table_{getuid()}" - - try: - with When("I grant the create temporary table privilege"): - node.query( - f"GRANT CREATE TEMPORARY TABLE ON *.* TO {grant_target_name}" - ) - - with And("I revoke ALL privilege"): - node.query(f"REVOKE ALL ON *.* FROM {grant_target_name}") - - with Then("I attempt to create a temporary table"): - node.query( - f"CREATE TEMPORARY TABLE {temp_table_name} (x Int8)", - settings=[("user", user_name)], - exitcode=exitcode, - message=message, - ) - - finally: - with Finally("I drop the temporary table"): - node.query(f"DROP TEMPORARY TABLE IF EXISTS {temp_table_name}") - - with Scenario("user with ALL privilege"): - temp_table_name = f"temp_table_{getuid()}" - - try: - with When("I grant ALL privilege"): - node.query(f"GRANT ALL ON *.* TO {grant_target_name}") - - with Then("I attempt to create aa temporary table"): - node.query( - f"CREATE TEMPORARY TABLE {temp_table_name} (x Int8)", - settings=[("user", user_name)], - ) - - finally: - with Finally("I drop the temporary table"): - node.query(f"DROP TEMPORARY TABLE IF EXISTS {temp_table_name}") - @TestFeature @Requirements( @@ -165,8 +124,10 @@ def feature(self, node="clickhouse1", stress=None, parallel=None): if stress is not None: self.context.stress = stress - with Suite( - test=privilege_granted_directly_or_via_role, - setup=instrument_clickhouse_server_log, - ): - privilege_granted_directly_or_via_role() + for current().context.privilege in ["ALL", "CREATE", "CREATE TEMPORARY TABLE"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/drop/drop_database.py b/tests/testflows/rbac/tests/privileges/drop/drop_database.py index 3001285ef37..4d6a7f89d23 100644 --- a/tests/testflows/rbac/tests/privileges/drop/drop_database.py +++ b/tests/testflows/rbac/tests/privileges/drop/drop_database.py @@ -71,8 +71,10 @@ def privilege_check(grant_target_name, user_name, node=None): with Given("I have a database"): node.query(f"CREATE DATABASE {db_name}") - with When("I grant drop database privilege"): - node.query(f"GRANT DROP DATABASE ON {db_name}.* TO {grant_target_name}") + with When(f"I grant {current().context.privilege} privilege"): + node.query( + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" + ) with Then("I attempt to drop a database"): node.query(f"DROP DATABASE {db_name}", settings=[("user", user_name)]) @@ -88,39 +90,16 @@ def privilege_check(grant_target_name, user_name, node=None): with Given("I have a database"): node.query(f"CREATE DATABASE {db_name}") - with When("I grant the drop database privilege"): - node.query(f"GRANT DROP DATABASE ON {db_name}.* TO {grant_target_name}") - - with And("I revoke the drop database privilege"): + with When(f"I grant the {current().context.privilege} privilege"): node.query( - f"REVOKE DROP DATABASE ON {db_name}.* FROM {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) - with Then("I attempt to drop a database"): + with And(f"I revoke the {current().context.privilege} privilege"): node.query( - f"DROP DATABASE {db_name}", - settings=[("user", user_name)], - exitcode=exitcode, - message=message, + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" ) - finally: - with Finally("I drop the database"): - node.query(f"DROP DATABASE IF EXISTS {db_name}") - - with Scenario("user with revoked ALL privilege"): - db_name = f"db_{getuid()}" - - try: - with Given("I have a database"): - node.query(f"CREATE DATABASE {db_name}") - - with When("I grant the drop database privilege"): - node.query(f"GRANT DROP DATABASE ON {db_name}.* TO {grant_target_name}") - - with And("I revoke ALL privilege"): - node.query(f"REVOKE ALL ON *.* FROM {grant_target_name}") - with Then("I attempt to drop a database"): node.query( f"DROP DATABASE {db_name}", @@ -133,27 +112,11 @@ def privilege_check(grant_target_name, user_name, node=None): with Finally("I drop the database"): node.query(f"DROP DATABASE IF EXISTS {db_name}") - with Scenario("user with ALL privilege"): - db_name = f"db_{getuid()}" - - try: - with Given("I have a database"): - node.query(f"CREATE DATABASE {db_name}") - - with When("I grant ALL privilege"): - node.query(f"GRANT ALL ON *.* TO {grant_target_name}") - - with Then("I attempt to drop a database"): - node.query(f"DROP DATABASE {db_name}", settings=[("user", user_name)]) - - finally: - with Finally("I drop the database"): - node.query(f"DROP DATABASE IF EXISTS {db_name}") - @TestFeature @Requirements( RQ_SRS_006_RBAC_Privileges_DropDatabase("1.0"), + RQ_SRS_006_RBAC_Privileges_Drop("1.0"), RQ_SRS_006_RBAC_Privileges_All("1.0"), RQ_SRS_006_RBAC_Privileges_None("1.0"), ) @@ -167,8 +130,10 @@ def feature(self, node="clickhouse1", stress=None, parallel=None): if stress is not None: self.context.stress = stress - with Suite( - test=privilege_granted_directly_or_via_role, - setup=instrument_clickhouse_server_log, - ): - privilege_granted_directly_or_via_role() + for current().context.privilege in ["ALL", "DROP", "DROP DATABASE"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/drop/drop_dictionary.py b/tests/testflows/rbac/tests/privileges/drop/drop_dictionary.py index 7d5958945b1..84e63eeaca0 100644 --- a/tests/testflows/rbac/tests/privileges/drop/drop_dictionary.py +++ b/tests/testflows/rbac/tests/privileges/drop/drop_dictionary.py @@ -73,9 +73,9 @@ def privilege_check(grant_target_name, user_name, node=None): f"CREATE DICTIONARY {dict_name}(x Int32, y Int32) PRIMARY KEY x LAYOUT(FLAT()) SOURCE(CLICKHOUSE()) LIFETIME(0)" ) - with When("I grant drop dictionary privilege"): + with When(f"I grant {current().context.privilege} privilege"): node.query( - f"GRANT DROP DICTIONARY ON {dict_name} TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) with Then("I attempt to drop aa dictionary"): @@ -96,14 +96,14 @@ def privilege_check(grant_target_name, user_name, node=None): f"CREATE DICTIONARY {dict_name}(x Int32, y Int32) PRIMARY KEY x LAYOUT(FLAT()) SOURCE(CLICKHOUSE()) LIFETIME(0)" ) - with When("I grant the drop dictionary privilege"): + with When(f"I grant the {current().context.privilege} privilege"): node.query( - f"GRANT DROP DICTIONARY ON {dict_name} TO {grant_target_name}" + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" ) - with And("I revoke the drop dictionary privilege"): + with And(f"I revoke the {current().context.privilege} privilege"): node.query( - f"REVOKE DROP DICTIONARY ON {dict_name} FROM {grant_target_name}" + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" ) with Then("I attempt to drop a dictionary"): @@ -118,31 +118,11 @@ def privilege_check(grant_target_name, user_name, node=None): with Finally("I drop the dictionary"): node.query(f"DROP DICTIONARY IF EXISTS {dict_name}") - with Scenario("user with ALL privilege"): - dict_name = f"db_{getuid()}" - - try: - with Given("I have a dictionary"): - node.query( - f"CREATE DICTIONARY {dict_name}(x Int32, y Int32) PRIMARY KEY x LAYOUT(FLAT()) SOURCE(CLICKHOUSE()) LIFETIME(0)" - ) - - with When("I grant ALL privilege"): - node.query(f"GRANT ALL ON *.* TO {grant_target_name}") - - with Then("I drop the dictionary"): - node.query( - f"DROP DICTIONARY {dict_name}", settings=[("user", user_name)] - ) - - finally: - with Finally("I drop the dictionary"): - node.query(f"DROP DICTIONARY IF EXISTS {dict_name}") - @TestFeature @Requirements( RQ_SRS_006_RBAC_Privileges_DropDictionary("1.0"), + RQ_SRS_006_RBAC_Privileges_Drop("1.0"), RQ_SRS_006_RBAC_Privileges_All("1.0"), RQ_SRS_006_RBAC_Privileges_None("1.0"), ) @@ -156,8 +136,10 @@ def feature(self, node="clickhouse1", stress=None, parallel=None): if stress is not None: self.context.stress = stress - with Suite( - test=privilege_granted_directly_or_via_role, - setup=instrument_clickhouse_server_log, - ): - privilege_granted_directly_or_via_role() + for current().context.privilege in ["ALL", "DROP", "DROP DICTIONARY"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/drop/drop_function.py b/tests/testflows/rbac/tests/privileges/drop/drop_function.py new file mode 100644 index 00000000000..b7985e92347 --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/drop/drop_function.py @@ -0,0 +1,139 @@ +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privilege_granted_directly_or_via_role(self, node=None): + """Check that user is only able to execute DROP FUNCTION when they have required privilege, either directly or via role.""" + role_name = f"role_{getuid()}" + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with Suite("user with direct privilege"): + with user(node, user_name): + + with When( + f"I run checks that {user_name} is only able to execute DROP FUNCTION with required privileges" + ): + privilege_check( + grant_target_name=user_name, user_name=user_name, node=node + ) + + with Suite("user with privilege via role"): + with user(node, user_name), role(node, role_name): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + with And( + f"I run checks that {user_name} with {role_name} is only able to execute DROP FUNCTION with required privileges" + ): + privilege_check( + grant_target_name=role_name, user_name=user_name, node=node + ) + + +def privilege_check(grant_target_name, user_name, node=None): + """Run scenarios to check the user's access with different privileges.""" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + + with Scenario("user without privilege"): + func_name = f"db_{getuid()}" + + try: + with Given("I have a function"): + node.query(f"CREATE FUNCTION {func_name} AS (x) -> 2*x;") + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I attempt to drop the function"): + node.query( + f"DROP FUNCTION {func_name}", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + finally: + with Finally("I drop the function"): + node.query(f"DROP FUNCTION IF EXISTS {func_name}") + + with Scenario("user with privilege"): + func_name = f"db_{getuid()}" + + try: + with Given("I have a function"): + node.query(f"CREATE FUNCTION {func_name} AS (x) -> 2*x;") + + with When(f"I grant {current().context.privilege} privilege"): + node.query( + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" + ) + + with Then("I attempt to drop a function"): + node.query(f"DROP FUNCTION {func_name}", settings=[("user", user_name)]) + + finally: + with Finally("I drop the function"): + node.query(f"DROP FUNCTION IF EXISTS {func_name}") + + with Scenario("user with revoked privilege"): + func_name = f"db_{getuid()}" + + try: + with Given("I have a function"): + node.query(f"CREATE FUNCTION {func_name} AS (x) -> 2*x;") + + with When(f"I grant the {current().context.privilege} privilege"): + node.query( + f"GRANT {current().context.privilege} ON *.* TO {grant_target_name}" + ) + + with And(f"I revoke the {current().context.privilege} privilege"): + node.query( + f"REVOKE {current().context.privilege} ON *.* FROM {grant_target_name}" + ) + + with Then("I attempt to drop a function"): + node.query( + f"DROP FUNCTION {func_name}", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + finally: + with Finally("I drop the function"): + node.query(f"DROP FUNCTION IF EXISTS {func_name}") + + +@TestFeature +@Requirements( + RQ_SRS_006_RBAC_Privileges_Drop("1.0"), + RQ_SRS_006_RBAC_Privileges_DropFunction("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_None("1.0"), +) +@Name("drop function") +def feature(self, node="clickhouse1", stress=None, parallel=None): + """Check the RBAC functionality of DROP FUNCTION.""" + self.context.node = self.context.cluster.node(node) + + if parallel is not None: + self.context.parallel = parallel + if stress is not None: + self.context.stress = stress + + for current().context.privilege in ["ALL", "DROP", "DROP FUNCTION"]: + with Suite( + f" {current().context.privilege} privilege", + test=privilege_granted_directly_or_via_role, + setup=instrument_clickhouse_server_log, + ): + privilege_granted_directly_or_via_role() diff --git a/tests/testflows/rbac/tests/privileges/drop/drop_replica.py b/tests/testflows/rbac/tests/privileges/drop/drop_replica.py new file mode 100644 index 00000000000..20ac088f551 --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/drop/drop_replica.py @@ -0,0 +1,146 @@ +from testflows.core import * +from testflows.asserts import error + +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM DROP REPLICA` commands if and only if + the privilege has been granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=drop_replica, + examples=Examples( + "privilege on grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in drop_replica.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM DROP REPLICA` commands if and only if + the privilege has been granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=drop_replica, + examples=Examples( + "privilege on grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in drop_replica.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Examples( + "privilege on", + [ + ("ALL", "*.*"), + ("SYSTEM", "*.*"), + ("SYSTEM DROP REPLICA", "table"), + ("DROP REPLICA", "table"), + ], +) +def drop_replica(self, privilege, on, grant_target_name, user_name, node=None): + """Check that user is only able to execute `SYSTEM DROP REPLICA` when they have privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + table_name = f"table_name_{getuid()}" + + if node is None: + node = self.context.node + + on = on.replace("table", f"{table_name}") + + with table(node, table_name, "ReplicatedMergeTree-sharded_cluster"): + + with When("I get the name of the replica associated with the table"): + replica_name = node.query( + f"SELECT replica_name FROM system.replicas WHERE table = '{table_name}'" + ).output + + with Scenario("SYSTEM DROP REPLICA without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user can't drop replica"): + node.query( + f"SYSTEM DROP REPLICA '{replica_name}'", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM DROP REPLICA with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON {on} TO {grant_target_name}") + + with Then("I check the user can drop replica"): + node.query( + f"SYSTEM DROP REPLICA {replica_name}", + settings=[("user", f"{user_name}")], + ) + + with Scenario("SYSTEM DROP REPLICA with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON {on} TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON {on} FROM {grant_target_name}") + + with Then("I check the user can't drop replica"): + node.query( + f"SYSTEM DROP REPLICA {replica_name}", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + +@TestFeature +@Name("system drop replica") +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_DropReplica("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_None("1.0"), +) +def feature(self, node="clickhouse1"): + """Check the RBAC functionality of SYSTEM DROP REPLICA.""" + self.context.node = self.context.cluster.node(node) + + Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) + Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_log) diff --git a/tests/testflows/rbac/tests/privileges/drop/drop_table.py b/tests/testflows/rbac/tests/privileges/drop/drop_table.py index daafa250462..9b3214649c9 100644 --- a/tests/testflows/rbac/tests/privileges/drop/drop_table.py +++ b/tests/testflows/rbac/tests/privileges/drop/drop_table.py @@ -147,11 +147,29 @@ def privilege_check(grant_target_name, user_name, node=None): with Finally("I drop the table"): node.query(f"DROP TABLE IF EXISTS {table_name}") + with Scenario("user with DROP privilege"): + table_name = f"table_{getuid()}" + + try: + with Given("I have a table"): + node.query(f"CREATE TABLE {table_name} (x Int8) ENGINE=Memory") + + with When("I grant DROP privilege"): + node.query(f"GRANT DROP ON *.* TO {grant_target_name}") + + with Then("I drop the table"): + node.query(f"DROP TABLE {table_name}", settings=[("user", user_name)]) + + finally: + with Finally("I drop the table"): + node.query(f"DROP TABLE IF EXISTS {table_name}") + @TestFeature @Requirements( RQ_SRS_006_RBAC_Privileges_DropTable("1.0"), RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_Drop("1.0"), RQ_SRS_006_RBAC_Privileges_None("1.0"), ) @Name("drop table") diff --git a/tests/testflows/rbac/tests/privileges/feature.py b/tests/testflows/rbac/tests/privileges/feature.py index 58d24d1f1f7..9bcb20cec6b 100755 --- a/tests/testflows/rbac/tests/privileges/feature.py +++ b/tests/testflows/rbac/tests/privileges/feature.py @@ -203,6 +203,11 @@ def feature(self): parallel=True, executor=pool, ) + Feature( + run=load("rbac.tests.privileges.alter.alter_database", "feature"), + parallel=True, + executor=pool, + ) Feature( run=load( "rbac.tests.privileges.alter.alter_settings_profile", "feature" @@ -258,6 +263,11 @@ def feature(self): parallel=True, executor=pool, ) + Feature( + run=load("rbac.tests.privileges.create.create_function", "feature"), + parallel=True, + executor=pool, + ) Feature( run=load("rbac.tests.privileges.attach.attach_database", "feature"), @@ -320,6 +330,16 @@ def feature(self): parallel=True, executor=pool, ) + Feature( + run=load("rbac.tests.privileges.drop.drop_function", "feature"), + parallel=True, + executor=pool, + ) + Feature( + run=load("rbac.tests.privileges.drop.drop_replica", "feature"), + parallel=True, + executor=pool, + ) Feature( run=load("rbac.tests.privileges.detach.detach_database", "feature"), @@ -382,6 +402,11 @@ def feature(self): parallel=True, executor=pool, ) + Feature( + run=load("rbac.tests.privileges.system.restore_replica", "feature"), + parallel=True, + executor=pool, + ) Feature( run=load("rbac.tests.privileges.system.sends", "feature"), parallel=True, @@ -397,6 +422,36 @@ def feature(self): parallel=True, executor=pool, ) + Feature( + run=load("rbac.tests.privileges.system.restart_disk", "feature"), + parallel=True, + executor=pool, + ) + Feature( + run=load("rbac.tests.privileges.system.thread_fuzzer", "feature"), + parallel=True, + executor=pool, + ) + Feature( + run=load("rbac.tests.privileges.table_functions", "feature"), + parallel=True, + executor=pool, + ) + Feature( + run=load("rbac.tests.privileges.projections", "feature"), + parallel=True, + executor=pool, + ) + Feature( + run=load("rbac.tests.privileges.grant_drop_user_race", "feature"), + parallel=True, + executor=pool, + ) + Feature( + run=load("rbac.tests.privileges.race_condition", "feature"), + parallel=True, + executor=pool, + ) finally: join() diff --git a/tests/testflows/rbac/tests/privileges/grant_drop_user_race.py b/tests/testflows/rbac/tests/privileges/grant_drop_user_race.py new file mode 100644 index 00000000000..cfcedca8a76 --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/grant_drop_user_race.py @@ -0,0 +1,83 @@ +import time + +from testflows.core import * +from testflows.asserts import error + +from rbac.requirements import * +from rbac.helper.common import * + + +@TestStep(Then) +def drop_user(self, node, user): + """Drop the provided user.""" + with Then(f"I drop {user}"): + node.query(f"DROP USER IF EXISTS {user}") + + +@TestStep(Then) +def grant_all(self, node, from_user, to_user): + """Grant all from one user to another.""" + try: + with Then(f"{from_user} grants all to {to_user}"): + node.query(f"GRANT ALL ON *.* TO {to_user}", settings=[("user", from_user)]) + self.context.privilege = True + + except: + self.context.privilege = False + + +@TestFeature +@Name("grant drop user race") +def feature(self, stress=None, node="clickhouse1"): + """Check race condition when granting privileges and dropping users.""" + node = self.context.cluster.node(node) + + role_name = f"role_{getuid()}" + user0_name = f"user0_{getuid()}" + user1_name = f"user1_{getuid()}" + table_name = f"table_{getuid()}" + + if stress is not None: + self.context.stress = stress + + with role(node, role_name): + with user(node, user0_name): + with Given("The user has no privileges"): + node.query(f"REVOKE ALL ON *.* FROM {user0_name}") + + with And(f"I have a table {table_name}"): + node.query(f"CREATE TABLE {table_name} (n int) engine=Memory") + + with And("It has some values"): + node.query(f"INSERT INTO {table_name} VALUES (1)") + start = time.time() + + while time.time() - start < 10: + + with When("I create another user"): + node.query(f"CREATE USER IF NOT EXISTS {user1_name} GRANTEES NONE") + + with And(f"I grant all to the user {user1_name} with grant option"): + node.query(f"GRANT ALL ON *.* TO {user1_name} WITH GRANT OPTION") + + with Then(f"I drop the user"): + Step(test=drop_user, parallel=True)(node=node, user=user1_name) + + with And(f"Grant privilege to the original user in parallel"): + Step(test=grant_all, parallel=True)( + node=node, to_user=user0_name, from_user=user1_name + ) + + with Finally(f"I check if {user0_name} succesfully gained privileges."): + if self.context.privilege: + node.query( + f"SELECT * FROM {table_name}", + settings=[("user", user0_name)], + ) + else: + node.query( + f"SELECT * FROM {table_name}", + message="DB::Exception: user0_grant_drop_user_race", + exitcode=241, + settings=[("user", user0_name)], + ) diff --git a/tests/testflows/rbac/tests/privileges/introspection.py b/tests/testflows/rbac/tests/privileges/introspection.py index b36085ced96..676a1564810 100644 --- a/tests/testflows/rbac/tests/privileges/introspection.py +++ b/tests/testflows/rbac/tests/privileges/introspection.py @@ -145,6 +145,122 @@ def addressToLine(self, privilege, grant_target_name, user_name, node=None): ) +@TestSuite +def addressToLineWithInlines_privileges_granted_directly(self, node=None): + """Check that a user is able to execute `addressToLineWithInlines` with privileges are granted directly.""" + + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=addressToLineWithInlines, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in addressToLineWithInlines.examples + ], + args=Args(name="privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def addressToLineWithInlines_privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `addressToLineWithInlines` with privileges are granted through a role.""" + + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=addressToLineWithInlines, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in addressToLineWithInlines.examples + ], + args=Args(name="privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Examples( + "privilege", + [ + ("ALL",), + ("INTROSPECTION",), + ("INTROSPECTION FUNCTIONS",), + ("addressToLineWithInlines",), + ], +) +@Requirements( + RQ_SRS_006_RBAC_Privileges_Introspection_addressToLineWithInlines("1.0"), +) +def addressToLineWithInlines(self, privilege, grant_target_name, user_name, node=None): + """Check that user is only able to execute `addressToLineWithInlines` when they have the necessary privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + + if node is None: + node = self.context.node + + with Scenario("addressToLineWithInlines without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user can't use addressToLineWithInlines"): + node.query( + f"WITH addressToLineWithInlines(toUInt64(dummy)) AS addr SELECT 1 WHERE addr = ''", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + with Scenario("addressToLineWithInlines with privilege"): + + with When(f"I grant {privilege}"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then("I check the user can use addressToLineWithInlines"): + node.query( + f"WITH addressToLineWithInlines(toUInt64(dummy)) AS addr SELECT 1 WHERE addr = '[]'", + settings=[("user", f"{user_name}")], + ) + + with Scenario("addressToLineWithInlines with revoked privilege"): + + with When(f"I grant {privilege}"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege}"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then("I check the user cannot use addressToLineWithInlines"): + node.query( + f"WITH addressToLineWithInlines(toUInt64(dummy)) AS addr SELECT 1 WHERE addr = ''", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + @TestSuite def addressToSymbol_privileges_granted_directly(self, node=None): """Check that a user is able to execute `addressToSymbol` with privileges are granted directly.""" @@ -405,6 +521,14 @@ def feature(self, node="clickhouse1"): run=addressToSymbol_privileges_granted_via_role, setup=instrument_clickhouse_server_log, ) + Suite( + run=addressToLineWithInlines_privileges_granted_directly, + setup=instrument_clickhouse_server_log, + ) + Suite( + run=addressToLineWithInlines_privileges_granted_via_role, + setup=instrument_clickhouse_server_log, + ) Suite( run=demangle_privileges_granted_directly, setup=instrument_clickhouse_server_log, diff --git a/tests/testflows/rbac/tests/privileges/projections.py b/tests/testflows/rbac/tests/privileges/projections.py new file mode 100644 index 00000000000..5cd31df55c7 --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/projections.py @@ -0,0 +1,304 @@ +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privilege_granted_directly_or_via_role(self, node=None): + """Check that user is only able to manipulate projections when they have required privilege, either directly or via role.""" + role_name = f"role_{getuid()}" + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with Suite("user with direct privilege"): + with user(node, user_name): + + with When( + f"I run checks that {user_name} is only able to manipulate projections with required privileges" + ): + for scenario in loads(current_module(), Scenario): + Scenario(test=scenario, name=scenario.name)( + grant_target_name=user_name, user_name=user_name + ) + + with Suite("user with privilege via role"): + with user(node, user_name), role(node, role_name): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + with And( + f"I run checks that {user_name} with {role_name} is only able to manipulate projections with required privileges" + ): + for scenario in loads(current_module(), Scenario): + Scenario(test=scenario, name=scenario.name)( + grant_target_name=role_name, user_name=user_name + ) + + +@TestScenario +@Name("ADD PROJECTION") +@Requirements( + RQ_SRS_006_RBAC_Privileges_AlterProjection_Add("1.0"), +) +def add_projection(self, grant_target_name, user_name, node=None): + """I check that user is only able to add projections with the ALTER TABLE ADD PROJECTION.""" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + table_name = f"table_{getuid()}" + proj_name = f"proj_{getuid()}" + node = node or self.context.node + privilege = ( + current().context.privilege + if current().context.privilege != "default" + else "ADD PROJECTION" + ) + + with table(node, table_name): + with When("I check that user is unable to add a projection"): + node.query( + f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + with Then(f"I grant the {privilege} to the {grant_target_name}"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with When("I check the user is able to add a projection"): + node.query( + f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)", + settings=[("user", user_name)], + ) + + with Then(f"I drop the projection"): + node.query(f"ALTER TABLE {table_name} DROP PROJECTION {proj_name}") + + with And(f"I revoke the {privilege} from {grant_target_name}"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with When("I check that user is unable to add a projection"): + node.query( + f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + +@TestScenario +@Name("DROP PROJECTION") +@Requirements( + RQ_SRS_006_RBAC_Privileges_AlterProjection_Drop("1.0"), +) +def drop_projection(self, grant_target_name, user_name, node=None): + """I check that user is only able to drop projections with the ALTER TABLE DROP PROJECTION.""" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + table_name = f"table_{getuid()}" + proj_name = f"proj_{getuid()}" + node = node or self.context.node + privilege = ( + current().context.privilege + if current().context.privilege != "default" + else "DROP PROJECTION" + ) + + with table(node, table_name): + + with Given("I have a projection"): + node.query( + f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)" + ) + + with When("I check that user is unable to drop a projection"): + node.query( + f"ALTER TABLE {table_name} DROP PROJECTION {proj_name}", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + with Then(f"I grant the {privilege} to the {grant_target_name}"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with When("I check the user is able to drop a projection"): + node.query( + f"ALTER TABLE {table_name} DROP PROJECTION {proj_name}", + settings=[("user", user_name)], + ) + + with Then(f"I add the projection back"): + node.query( + f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)" + ) + + with And(f"I revoke the {privilege} from {grant_target_name}"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with When("I check that user is unable to drop a projection"): + node.query( + f"ALTER TABLE {table_name} DROP PROJECTION {proj_name}", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + +@TestScenario +@Name("MATERIALIZE PROJECTION") +@Requirements( + RQ_SRS_006_RBAC_Privileges_AlterProjection_Materialize("1.0"), +) +def materialize_projection(self, grant_target_name, user_name, node=None): + """I check that user is only able to drop projections with the ALTER TABLE MATERIALIZE PROJECTION.""" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + table_name = f"table_{getuid()}" + proj_name = f"proj_{getuid()}" + node = node or self.context.node + privilege = ( + current().context.privilege + if current().context.privilege != "default" + else "MATERIALIZE PROJECTION" + ) + + with table(node, table_name, "ReplicatedMergeTree-one_shard_cluster"): + + with Given("I have a projection"): + node.query( + f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)" + ) + + with And("I have some data on the table"): + node.query( + f"INSERT INTO {table_name} VALUES ('2019-01-01', 'a', 2, 'zzzz', 8)" + ) + + with When("I check that user is unable to materialize a projection"): + node.query( + f"ALTER TABLE {table_name} MATERIALIZE PROJECTION {proj_name} IN PARTITION 8", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + with Then(f"I grant the {privilege} to the {grant_target_name}"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with When("I check the user is able to materialize a projection"): + node.query( + f"ALTER TABLE {table_name} MATERIALIZE PROJECTION {proj_name} IN PARTITION 8", + settings=[("user", user_name)], + ) + + with And(f"I revoke the {privilege} from {grant_target_name}"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with When("I check that user is unable to materialize a projection"): + node.query( + f"ALTER TABLE {table_name} MATERIALIZE PROJECTION {proj_name} IN PARTITION 8", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + +@TestScenario +@Name("CLEAR PROJECTION") +@Requirements( + RQ_SRS_006_RBAC_Privileges_AlterProjection_Clear("1.0"), +) +def clear_projection(self, grant_target_name, user_name, node=None): + """I check that user is only able to drop projections with the ALTER TABLE CLEAR PROJECTION.""" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + table_name = f"table_{getuid()}" + proj_name = f"proj_{getuid()}" + node = node or self.context.node + privilege = ( + current().context.privilege + if current().context.privilege != "default" + else "CLEAR PROJECTION" + ) + + with table(node, table_name, "ReplicatedMergeTree-one_shard_cluster"): + + with Given("I have a projection"): + node.query( + f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)" + ) + + with And("I have some data on the table"): + node.query( + f"INSERT INTO {table_name} VALUES ('2019-01-01', 'a', 2, 'zzzz', 8)" + ) + + with When("I check that user is unable to clear a projection"): + node.query( + f"ALTER TABLE {table_name} CLEAR PROJECTION {proj_name} IN PARTITION 8", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + with Then(f"I grant the {privilege} to the {grant_target_name}"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with When("I check the user is able to clear a projection"): + node.query( + f"ALTER TABLE {table_name} CLEAR PROJECTION {proj_name} IN PARTITION 8", + settings=[("user", user_name)], + ) + + # with Then(f"I add the projection back"): + # node.query(f"ALTER TABLE {table_name} ADD PROJECTION {proj_name} (SELECT y)") + + with And(f"I revoke the {privilege} from {grant_target_name}"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with When("I check that user is unable to clear a projection"): + node.query( + f"ALTER TABLE {table_name} CLEAR PROJECTION {proj_name} IN PARTITION 8", + settings=[("user", user_name)], + exitcode=exitcode, + message=message, + ) + + +@TestFeature +@Requirements( + RQ_SRS_006_RBAC_Privileges_AlterProjection("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), +) +@Name("projections") +def feature(self, node="clickhouse1", stress=None, parallel=None): + """Check the RBAC functionality of projections.""" + self.context.node = self.context.cluster.node(node) + + if parallel is not None: + self.context.parallel = parallel + if stress is not None: + self.context.stress = stress + + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + for current().context.privilege in ["ALL", "ALTER PROJECTION", "default"]: + for scenario in loads(current_module(), Scenario): + with user(self.context.node, user_name): + Scenario( + f" {current().context.privilege} privilege, {scenario.name}, privilege granted to user", + test=scenario, + setup=instrument_clickhouse_server_log, + )(grant_target_name=user_name, user_name=user_name) + + with user(self.context.node, user_name), role(self.context.node, role_name): + + with When("I grant the role to the user"): + self.context.node.query(f"GRANT {role_name} TO {user_name}") + + Scenario( + f" {current().context.privilege} privilege, {scenario.name}, privilege granted to role", + test=scenario, + setup=instrument_clickhouse_server_log, + )(grant_target_name=role_name, user_name=user_name) diff --git a/tests/testflows/rbac/tests/privileges/race_condition.py b/tests/testflows/rbac/tests/privileges/race_condition.py new file mode 100644 index 00000000000..aee5c19e180 --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/race_condition.py @@ -0,0 +1,15 @@ +from testflows.core import * + +from rbac.helper.common import * + + +@TestFeature +@Name("race condition") +def feature(self): + """Check RBAC behaves as expected under heavy load with threadfuzzer enabled.""" + + self.context.cluster.node("clickhouse1").enable_thread_fuzzer() + + Feature( + run=load("rbac.tests.privileges.alter.alter_column", "feature"), parallel=True + ) diff --git a/tests/testflows/rbac/tests/privileges/system/drop_cache.py b/tests/testflows/rbac/tests/privileges/system/drop_cache.py index cda6838b974..d49bc8eb476 100644 --- a/tests/testflows/rbac/tests/privileges/system/drop_cache.py +++ b/tests/testflows/rbac/tests/privileges/system/drop_cache.py @@ -369,6 +369,253 @@ def uncompressed_cache(self, privilege, grant_target_name, user_name, node=None) ) +@TestSuite +def mmap_cache_privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM DROP MMAP CACHE` if and only if + they have `SYSTEM DROP MMAP CACHE` privilege granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=mmap_cache, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in mmap_cache.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def mmap_cache_privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM DROP MMAP CACHE` if and only if + they have `SYSTEM DROP MMAP CACHE` privilege granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=mmap_cache, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in mmap_cache.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_DropCache_Mmap("1.0"), +) +@Examples( + "privilege", + [ + ("ALL",), + ("SYSTEM",), + ("SYSTEM DROP CACHE",), + ("SYSTEM DROP MMAP CACHE",), + ("DROP CACHE",), + ("DROP MMAP CACHE",), + ("SYSTEM DROP MMAP",), + ("DROP MMAP",), + ], +) +def mmap_cache(self, privilege, grant_target_name, user_name, node=None): + """Run checks for `SYSTEM DROP MMAP CACHE` privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + + if node is None: + node = self.context.node + + with Scenario("SYSTEM DROP MMAP CACHE without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user is unable to execute SYSTEM DROP MMAP CACHE"): + node.query( + "SYSTEM DROP MMAP CACHE", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM DROP MMAP CACHE with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then("I check the user is bale to execute SYSTEM DROP MMAP CACHE"): + node.query("SYSTEM DROP MMAP CACHE", settings=[("user", f"{user_name}")]) + + with Scenario("SYSTEM DROP MMAP CACHE with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then("I check the user is unable to execute SYSTEM DROP MMAP CACHE"): + node.query( + "SYSTEM DROP MMAP CACHE", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + +@TestSuite +def compiled_expression_cache_privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM DROP COMPILED EXPRESSION CACHE` if and only if + they have `SYSTEM DROP COMPILED EXPRESSION CACHE` privilege granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=compiled_expression_cache, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in compiled_expression_cache.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def compiled_expression_cache_privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM DROP COMPILED EXPRESSION CACHE` if and only if + they have `SYSTEM DROP COMPILED EXPRESSION CACHE` privilege granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=compiled_expression_cache, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in compiled_expression_cache.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_DropCache_CompiledExpression("1.0"), +) +@Examples( + "privilege", + [ + ("ALL",), + ("SYSTEM",), + ("SYSTEM DROP CACHE",), + ("SYSTEM DROP COMPILED EXPRESSION CACHE",), + ("DROP CACHE",), + ("DROP COMPILED EXPRESSION CACHE",), + ("SYSTEM DROP COMPILED EXPRESSION",), + # ("DROP COMPILED EXPRESSION",), + ], +) +def compiled_expression_cache(self, privilege, grant_target_name, user_name, node=None): + """Run checks for `SYSTEM DROP COMPILED EXPRESSION CACHE` privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + + if node is None: + node = self.context.node + + with Scenario("SYSTEM DROP COMPILED EXPRESSION CACHE without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then( + "I check the user is unable to execute SYSTEM DROP COMPILED EXPRESSION CACHE" + ): + node.query( + "SYSTEM DROP COMPILED EXPRESSION CACHE", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM DROP COMPILED EXPRESSION CACHE with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then( + "I check the user is bale to execute SYSTEM DROP COMPILED EXPRESSION CACHE" + ): + node.query( + "SYSTEM DROP COMPILED EXPRESSION CACHE", + settings=[("user", f"{user_name}")], + ) + + with Scenario("SYSTEM DROP COMPILED EXPRESSION CACHE with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then( + "I check the user is unable to execute SYSTEM DROP COMPILED EXPRESSION CACHE" + ): + node.query( + "SYSTEM DROP COMPILED EXPRESSION CACHE", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + @TestFeature @Name("system drop cache") @Requirements( @@ -404,3 +651,19 @@ def feature(self, node="clickhouse1"): run=uncompressed_cache_privileges_granted_via_role, setup=instrument_clickhouse_server_log, ) + Suite( + run=mmap_cache_privileges_granted_directly, + setup=instrument_clickhouse_server_log, + ) + Suite( + run=mmap_cache_privileges_granted_via_role, + setup=instrument_clickhouse_server_log, + ) + Suite( + run=compiled_expression_cache_privileges_granted_directly, + setup=instrument_clickhouse_server_log, + ) + Suite( + run=compiled_expression_cache_privileges_granted_via_role, + setup=instrument_clickhouse_server_log, + ) diff --git a/tests/testflows/rbac/tests/privileges/system/reload.py b/tests/testflows/rbac/tests/privileges/system/reload.py index d0c7a2caea8..3a184009c09 100644 --- a/tests/testflows/rbac/tests/privileges/system/reload.py +++ b/tests/testflows/rbac/tests/privileges/system/reload.py @@ -121,7 +121,7 @@ def config(self, privilege, grant_target_name, user_name, node=None): with When(f"I grant {privilege} on the table"): node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") - with Then("I check the user is bale to execute SYSTEM RELOAD CONFIG"): + with Then("I check the user is able to execute SYSTEM RELOAD CONFIG"): node.query("SYSTEM RELOAD CONFIG", settings=[("user", f"{user_name}")]) with Scenario("SYSTEM RELOAD CONFIG with revoked privilege"): @@ -248,7 +248,7 @@ def dictionary(self, privilege, grant_target_name, user_name, node=None): with When(f"I grant {privilege} on the table"): node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") - with Then("I check the user is bale to execute SYSTEM RELOAD DICTIONARY"): + with Then("I check the user is able to execute SYSTEM RELOAD DICTIONARY"): node.query( f"SYSTEM RELOAD DICTIONARY default.{dict_name}", settings=[("user", f"{user_name}")], @@ -373,7 +373,7 @@ def dictionaries(self, privilege, grant_target_name, user_name, node=None): with When(f"I grant {privilege} on the table"): node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") - with Then("I check the user is bale to execute SYSTEM RELOAD DICTIONARIES"): + with Then("I check the user is able to execute SYSTEM RELOAD DICTIONARIES"): node.query( "SYSTEM RELOAD DICTIONARIES", settings=[("user", f"{user_name}")] ) @@ -494,7 +494,7 @@ def embedded_dictionaries(self, privilege, grant_target_name, user_name, node=No node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") with Then( - "I check the user is bale to execute SYSTEM RELOAD EMBEDDED DICTIONARIES" + "I check the user is able to execute SYSTEM RELOAD EMBEDDED DICTIONARIES" ): node.query( "SYSTEM RELOAD EMBEDDED DICTIONARIES", @@ -520,6 +520,272 @@ def embedded_dictionaries(self, privilege, grant_target_name, user_name, node=No ) +@TestSuite +def function_privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM RELOAD FUNCTION` if and only if + they have `SYSTEM RELOAD FUNCTION` privilege granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=function, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in function.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def function_privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM RELOAD FUNCTION` if and only if + they have `SYSTEM RELOAD FUNCTION` privilege granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=function, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in function.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_Reload_Function("1.0"), +) +@Examples( + "privilege", + [ + ("ALL",), + ("SYSTEM",), + ("SYSTEM RELOAD",), + ("SYSTEM RELOAD FUNCTION",), + ], +) +def function(self, privilege, grant_target_name, user_name, node=None): + """Run checks for `SYSTEM RELOAD FUNCTION` privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + func_name = f"func_{getuid()}" + + if node is None: + node = self.context.node + + try: + with Given("I have a function"): + node.query(f"CREATE FUNCTION {func_name} AS (x) -> 2*x;") + + with Scenario("SYSTEM RELOAD FUNCTION without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user is unable to execute SYSTEM RELOAD FUNCTIONS"): + node.query( + "SYSTEM RELOAD FUNCTIONS", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + # with And( + # "I check the user is unable to execute SYSTEM RELOAD FUNCTION on a specific function" + # ): + # node.query( + # f"SYSTEM RELOAD FUNCTION {func_name}", + # settings=[("user", f"{user_name}")], + # exitcode=exitcode, + # message=message, + # ) + + with Scenario("SYSTEM RELOAD FUNCTION with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then("I check the user is able to execute SYSTEM RELOAD FUNCTIONS"): + node.query( + "SYSTEM RELOAD FUNCTIONS", + settings=[("user", f"{user_name}")], + ) + + # with And( + # "I check the user is able to execute SYSTEM RELOAD FUNCTION on a specific function" + # ): + # node.query( + # f"SYSTEM RELOAD FUNCTION {func_name}", + # settings=[("user", f"{user_name}")], + # ) + + with Scenario("SYSTEM RELOAD FUNCTION with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then("I check the user is unable to execute SYSTEM RELOAD FUNCTIONS"): + node.query( + "SYSTEM RELOAD FUNCTIONS", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + # with And( + # "I check the user is unable to execute SYSTEM RELOAD FUNCTION on a specific function" + # ): + # node.query( + # f"SYSTEM RELOAD FUNCTION {func_name}", + # settings=[("user", f"{user_name}")], + # exitcode=exitcode, + # message=message, + # ) + finally: + with Finally("I drop the function"): + node.query(f"DROP FUNCTION IF EXISTS {func_name}") + + +@TestSuite +def symbols_privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM RELOAD SYMBOLS` if and only if + they have `SYSTEM RELOAD SYMBOLS` privilege granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=symbols, + examples=Examples( + "privilege grant_target_name user_name", + [tuple(list(row) + [user_name, user_name]) for row in symbols.examples], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def symbols_privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM RELOAD SYMBOLS` if and only if + they have `SYSTEM RELOAD SYMBOLS` privilege granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=symbols, + examples=Examples( + "privilege grant_target_name user_name", + [tuple(list(row) + [role_name, user_name]) for row in symbols.examples], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_Reload_Symbols("1.0"), +) +@Examples( + "privilege", + [ + ("ALL",), + ("SYSTEM",), + ("SYSTEM RELOAD",), + ("SYSTEM RELOAD SYMBOLS",), + ], +) +def symbols(self, privilege, grant_target_name, user_name, node=None): + """Run checks for `SYSTEM RELOAD SYMBOLS` privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + + if node is None: + node = self.context.node + + with Scenario("SYSTEM RELOAD SYMBOLS without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user is unable to execute SYSTEM RELOAD SYMBOLS"): + node.query( + "SYSTEM RELOAD SYMBOLS", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM RELOAD SYMBOLS with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then("I check the user is able to execute SYSTEM RELOAD SYMBOLS"): + node.query( + "SYSTEM RELOAD SYMBOLS", + settings=[("user", f"{user_name}")], + ) + + with Scenario("SYSTEM RELOAD SYMBOLS with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then("I check the user is unable to execute SYSTEM RELOAD SYMBOLS"): + node.query( + "SYSTEM RELOAD SYMBOLS", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + @TestFeature @Name("system reload") @Requirements( @@ -561,3 +827,19 @@ def feature(self, node="clickhouse1"): run=embedded_dictionaries_privileges_granted_via_role, setup=instrument_clickhouse_server_log, ) + Suite( + run=function_privileges_granted_directly, + setup=instrument_clickhouse_server_log, + ) + Suite( + run=function_privileges_granted_via_role, + setup=instrument_clickhouse_server_log, + ) + Suite( + run=symbols_privileges_granted_directly, + setup=instrument_clickhouse_server_log, + ) + Suite( + run=symbols_privileges_granted_via_role, + setup=instrument_clickhouse_server_log, + ) diff --git a/tests/testflows/rbac/tests/privileges/system/restart_disk.py b/tests/testflows/rbac/tests/privileges/system/restart_disk.py new file mode 100644 index 00000000000..cebc7718f0c --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/system/restart_disk.py @@ -0,0 +1,137 @@ +from testflows.core import * +from testflows.asserts import error + +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM RESTART DISK` commands if and only if + the privilege has been granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=restart_disk, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in restart_disk.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM RESTART DISK` commands if and only if + the privilege has been granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=restart_disk, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in restart_disk.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Examples( + "privilege", + [ + ("ALL",), + ("SYSTEM",), + ("SYSTEM RESTART DISK",), + ], +) +def restart_disk(self, privilege, grant_target_name, user_name, node=None): + """Check that user is only able to execute `SYSTEM RESTART DISK` when they have privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + + if node is None: + node = self.context.node + + with Scenario("SYSTEM RESTART DISK without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user can't restart disk"): + node.query( + f"SYSTEM RESTART DISK some_disk", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM RESTART DISK with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then("I check the user can restart disk"): + node.query( + f"SYSTEM RESTART DISK some_disk", + settings=[("user", f"{user_name}")], + exitcode=223, + message="DB::Exception: Unknown disk", + ) + + with Scenario("SYSTEM RESTART DISK with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then("I check the user can't restart disk"): + node.query( + f"SYSTEM RESTART DISK some_disk", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + +@TestFeature +@Name("system restart disk") +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_RestartDisk("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_None("1.0"), +) +def feature(self, node="clickhouse1"): + """Check the RBAC functionality of SYSTEM RESTART DISK.""" + self.context.node = self.context.cluster.node(node) + + Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) + Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_log) diff --git a/tests/testflows/rbac/tests/privileges/system/restore_replica.py b/tests/testflows/rbac/tests/privileges/system/restore_replica.py new file mode 100644 index 00000000000..29f7316f543 --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/system/restore_replica.py @@ -0,0 +1,143 @@ +from testflows.core import * +from testflows.asserts import error + +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM RESTORE REPLICA` commands if and only if + the privilege has been granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=restore_replica, + examples=Examples( + "privilege on grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in restore_replica.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM RESTORE REPLICA` commands if and only if + the privilege has been granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=restore_replica, + examples=Examples( + "privilege on grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in restore_replica.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Examples( + "privilege on", + [ + ("ALL", "*.*"), + ("SYSTEM", "*.*"), + ("SYSTEM RESTORE REPLICA", "table"), + ("RESTORE REPLICA", "table"), + ], +) +def restore_replica(self, privilege, on, grant_target_name, user_name, node=None): + """Check that user is only able to execute `SYSTEM RESTORE REPLICA` when they have privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + table_name = f"table_name_{getuid()}" + + if node is None: + node = self.context.node + + on = on.replace("table", f"{table_name}") + + with table(node, table_name, "ReplicatedMergeTree-sharded_cluster"): + + with Scenario("SYSTEM RESTORE REPLICA without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user can't restore replica"): + node.query( + f"SYSTEM RESTORE REPLICA {table_name}", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM RESTORE REPLICA with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON {on} TO {grant_target_name}") + + with Then("I check the user can restore replica"): + node.query( + f"SYSTEM RESTORE REPLICA {table_name}", + settings=[("user", f"{user_name}")], + exitcode=36, + message="DB::Exception: Replica must be readonly", + ) + + with Scenario("SYSTEM RESTORE REPLICA with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON {on} TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON {on} FROM {grant_target_name}") + + with Then("I check the user can't restore replica"): + node.query( + f"SYSTEM RESTORE REPLICA {table_name}", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + +@TestFeature +@Name("system restore replica") +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_RestoreReplica("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_None("1.0"), +) +def feature(self, node="clickhouse1"): + """Check the RBAC functionality of SYSTEM RESTORE REPLICA.""" + self.context.node = self.context.cluster.node(node) + + Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) + Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_log) diff --git a/tests/testflows/rbac/tests/privileges/system/thread_fuzzer.py b/tests/testflows/rbac/tests/privileges/system/thread_fuzzer.py new file mode 100644 index 00000000000..a6294d8bf3f --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/system/thread_fuzzer.py @@ -0,0 +1,217 @@ +from testflows.core import * +from testflows.asserts import error + +from rbac.requirements import * +from rbac.helper.common import * +import rbac.helper.errors as errors + + +@TestSuite +def privileges_granted_directly(self, node=None): + """Check that a user is able to execute `SYSTEM THREAD FUZZER` commands if and only if + the privilege has been granted directly. + """ + user_name = f"user_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"): + + Suite( + run=start_thread_fuzzer, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in start_thread_fuzzer.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + Suite( + run=stop_thread_fuzzer, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [user_name, user_name]) + for row in stop_thread_fuzzer.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestSuite +def privileges_granted_via_role(self, node=None): + """Check that a user is able to execute `SYSTEM THREAD FUZZER` commands if and only if + the privilege has been granted via role. + """ + user_name = f"user_{getuid()}" + role_name = f"role_{getuid()}" + + if node is None: + node = self.context.node + + with user(node, f"{user_name}"), role(node, f"{role_name}"): + + with When("I grant the role to the user"): + node.query(f"GRANT {role_name} TO {user_name}") + + Suite( + run=start_thread_fuzzer, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in start_thread_fuzzer.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + Suite( + run=stop_thread_fuzzer, + examples=Examples( + "privilege grant_target_name user_name", + [ + tuple(list(row) + [role_name, user_name]) + for row in stop_thread_fuzzer.examples + ], + args=Args(name="check privilege={privilege}", format_name=True), + ), + ) + + +@TestOutline(Suite) +@Examples( + "privilege", + [ + ("ALL",), + ("SYSTEM",), + ("SYSTEM THREAD FUZZER",), + ], +) +def start_thread_fuzzer(self, privilege, grant_target_name, user_name, node=None): + """Check that user is only able to execute `SYSTEM START THREAD FUZZER` when they have privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + + if node is None: + node = self.context.node + + with Scenario("SYSTEM START THREAD FUZZER without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user can't start thread fuzzer"): + node.query( + f"SYSTEM START THREAD FUZZER", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM START THREAD FUZZER with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then("I check the user can start thread fuzzer"): + node.query( + f"SYSTEM START THREAD FUZZER", settings=[("user", f"{user_name}")] + ) + + with Scenario("SYSTEM START THREAD FUZZER with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then("I check the user can't start thread fuzzer"): + node.query( + f"SYSTEM START THREAD FUZZER", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + +@TestOutline(Suite) +@Examples( + "privilege", + [ + ("ALL",), + ("SYSTEM",), + ("SYSTEM THREAD FUZZER",), + ], +) +def stop_thread_fuzzer(self, privilege, grant_target_name, user_name, node=None): + """Check that user is only able to execute `SYSTEM STOP THREAD FUZZER` when they have privilege.""" + exitcode, message = errors.not_enough_privileges(name=user_name) + + if node is None: + node = self.context.node + + with Scenario("SYSTEM STOP THREAD FUZZER without privilege"): + + with When("I grant the user NONE privilege"): + node.query(f"GRANT NONE TO {grant_target_name}") + + with And("I grant the user USAGE privilege"): + node.query(f"GRANT USAGE ON *.* TO {grant_target_name}") + + with Then("I check the user can't stop thread fuzzer"): + node.query( + f"SYSTEM STOP THREAD FUZZER", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + with Scenario("SYSTEM STOP THREAD FUZZER with privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with Then("I check the user can stop thread fuzzer"): + node.query( + f"SYSTEM STOP THREAD FUZZER", settings=[("user", f"{user_name}")] + ) + + with Scenario("SYSTEM STOP THREAD FUZZER with revoked privilege"): + + with When(f"I grant {privilege} on the table"): + node.query(f"GRANT {privilege} ON *.* TO {grant_target_name}") + + with And(f"I revoke {privilege} on the table"): + node.query(f"REVOKE {privilege} ON *.* FROM {grant_target_name}") + + with Then("I check the user can't stop thread fuzzer"): + node.query( + f"SYSTEM STOP THREAD FUZZER", + settings=[("user", f"{user_name}")], + exitcode=exitcode, + message=message, + ) + + +@TestFeature +@Name("system thread fuzzer") +@Requirements( + RQ_SRS_006_RBAC_Privileges_System_ThreadFuzzer("1.0"), + RQ_SRS_006_RBAC_Privileges_All("1.0"), + RQ_SRS_006_RBAC_Privileges_None("1.0"), +) +def feature(self, node="clickhouse1"): + """Check the RBAC functionality of SYSTEM THREAD FUZZER.""" + self.context.node = self.context.cluster.node(node) + + Suite(run=privileges_granted_directly, setup=instrument_clickhouse_server_log) + Suite(run=privileges_granted_via_role, setup=instrument_clickhouse_server_log) diff --git a/tests/testflows/rbac/tests/privileges/table_functions.py b/tests/testflows/rbac/tests/privileges/table_functions.py new file mode 100644 index 00000000000..c089ac2ed0c --- /dev/null +++ b/tests/testflows/rbac/tests/privileges/table_functions.py @@ -0,0 +1,320 @@ +from testflows.core import * +from testflows.asserts import error + +from rbac.helper.common import * +import rbac.helper.errors as errors +from rbac.requirements import ( + RQ_SRS_006_RBAC_Select_TableFunctions_Cluster, + RQ_SRS_006_RBAC_Select_TableFunctions_Remote, +) + + +@TestScenario +@Requirements(RQ_SRS_006_RBAC_Select_TableFunctions_Remote("1.0")) +def remote(self, node=None): + """Check that user is able to create a table as remote table function + only if they have REMOTE, SELECT, and CREATE TEMPORARY TABLE priviliges. + """ + user_name = f"user_{getuid()}" + table_name = f"table_{getuid()}" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + + if node is None: + node = self.context.node + + node2 = self.context.cluster.node("clickhouse2") + node3 = self.context.cluster.node("clickhouse3") + + try: + with Given("I have a table on a cluster with two nodes on seperate shards"): + node.query( + f"CREATE TABLE {table_name} ON CLUSTER sharded_cluster12 (x UInt8) ENGINE=Memory" + ) + + with And(f"I have a user {user_name} on three nodes on seperate shards"): + node.query(f"CREATE USER {user_name} ON CLUSTER sharded_cluster") + + with And("I have some data in the table on clickhouse1"): + node.query(f"INSERT INTO {table_name} VALUES (1)") + + with When( + f"I try to select from the table using remote table function as {user_name}" + ): + node.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then("I grant CREATE TEMPORARY TABLE and REMOTE privileges to a user"): + node.query(f"GRANT CREATE TEMPORARY TABLE ON *.* TO {user_name}") + node.query(f"GRANT REMOTE ON *.* TO {user_name}") + + with When( + f"I try to select from the table using remote table function as {user_name}" + ): + node.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then("I grant SELECT privilege on the source table"): + node.query(f"GRANT SELECT ON {table_name} TO {user_name}") + + with And(f"I successfully select from the remote table as {user_name}"): + output = node.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + settings=[("user", f"{user_name}")], + ).output + default = node.query(f"SELECT * FROM {table_name}").output + assert output == default, error() + + with When( + "I try to select from the table as the same user, but from clickhouse2" + ): + node2.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then( + "I grant CREATE TEMPORARY TABLE and REMOTE to the user on clickhouse2" + ): + node2.query(f"GRANT CREATE TEMPORARY TABLE ON *.* TO {user_name}") + node2.query(f"GRANT REMOTE ON *.* TO {user_name}") + + with When( + "I try to select from the table as the same user, but from clickhouse2" + ): + node2.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then(f"I grant SELECT on {table_name} to the user on clickhouse2"): + node2.query(f"GRANT SELECT ON {table_name} TO {user_name}") + + with Then( + f"I successfully select from the remote table as {user_name} from clickhouse2" + ): + output = node2.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + settings=[("user", f"{user_name}")], + ).output + assert output == default, error() + + with When( + "I try to select from the table as the same user, but from clickhouse3" + ): + node3.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then( + "I grant CREATE TEMPORARY TABLE and REMOTE to the user on clickhouse3" + ): + node3.query(f"GRANT CREATE TEMPORARY TABLE ON *.* TO {user_name}") + node3.query(f"GRANT REMOTE ON *.* TO {user_name}") + + with When( + "I try to select from the table as the same user, but from clickhouse3" + ): + node3.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then(f"I grant SELECT on {table_name} to the user on clickhouse3"): + node3.query(f"GRANT SELECT ON {table_name} TO {user_name}") + + with Then( + f"I successfully select from the remote table as {user_name} from clickhouse3" + ): + output = node3.query( + f"SELECT * FROM remote(sharded_cluster12, default.{table_name})", + settings=[("user", f"{user_name}")], + ).output + assert output == default, error() + + finally: + with Finally(f"I drop the table {table_name} from the cluster", flags=TE): + node.query( + f"DROP TABLE IF EXISTS {table_name} ON CLUSTER sharded_cluster12" + ) + + with And(f"I drop the user from the cluster", flags=TE): + node.query(f"DROP USER IF EXISTS {user_name} ON CLUSTER sharded_cluster") + + +@TestScenario +@Requirements(RQ_SRS_006_RBAC_Select_TableFunctions_Cluster("1.0")) +def cluster(self, node=None): + """Check that user is able to create a table as cluster table function + only if they have REMOTE, SELECT, and CREATE TEMPORARY TABLE priviliges. + """ + user_name = f"user_{getuid()}" + table_name = f"table_{getuid()}" + exitcode, message = errors.not_enough_privileges(name=f"{user_name}") + + if node is None: + node = self.context.node + + node2 = self.context.cluster.node("clickhouse2") + node3 = self.context.cluster.node("clickhouse3") + + try: + with Given("I have a table on a cluster with two nodes on seperate shards"): + node.query( + f"CREATE TABLE {table_name} ON CLUSTER sharded_cluster12 (x UInt8) ENGINE=Memory" + ) + + with And(f"I have a user {user_name} on three nodes on seperate shards"): + node.query(f"CREATE USER {user_name} ON CLUSTER sharded_cluster") + + with And("I have some data in the table on clickhouse1"): + node.query(f"INSERT INTO {table_name} VALUES (1)") + + with When( + f"I try to select from the table using cluster table function as {user_name}" + ): + node.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then("I grant CREATE TEMPORARY TABLE and cluster privileges to a user"): + node.query(f"GRANT CREATE TEMPORARY TABLE ON *.* TO {user_name}") + node.query(f"GRANT REMOTE ON *.* TO {user_name}") + + with When( + f"I try to select from the table using cluster table function as {user_name}" + ): + node.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then("I grant SELECT privilege on the source table"): + node.query(f"GRANT SELECT ON {table_name} TO {user_name}") + + with And(f"I successfully select from the cluster table as {user_name}"): + output = node.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + settings=[("user", f"{user_name}")], + ).output + default = node.query(f"SELECT * FROM {table_name}").output + assert output == default, error() + + with When( + "I try to select from the table as the same user, but from clickhouse2" + ): + node2.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then( + "I grant CREATE TEMPORARY TABLE and cluster to the user on clickhouse2" + ): + node2.query(f"GRANT CREATE TEMPORARY TABLE ON *.* TO {user_name}") + node2.query(f"GRANT REMOTE ON *.* TO {user_name}") + + with When( + "I try to select from the table as the same user, but from clickhouse2" + ): + node2.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then(f"I grant SELECT on {table_name} to the user on clickhouse2"): + node2.query(f"GRANT SELECT ON {table_name} TO {user_name}") + + with Then( + f"I successfully select from the cluster table as {user_name} from clickhouse2" + ): + output = node2.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + settings=[("user", f"{user_name}")], + ).output + assert output == default, error() + + with When( + "I try to select from the table as the same user, but from clickhouse3" + ): + node3.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then( + "I grant CREATE TEMPORARY TABLE and cluster to the user on clickhouse3" + ): + node3.query(f"GRANT CREATE TEMPORARY TABLE ON *.* TO {user_name}") + node3.query(f"GRANT REMOTE ON *.* TO {user_name}") + + with When( + "I try to select from the table as the same user, but from clickhouse3" + ): + node3.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + exitcode=exitcode, + message=message, + settings=[("user", f"{user_name}")], + ) + + with Then(f"I grant SELECT on {table_name} to the user on clickhouse3"): + node3.query(f"GRANT SELECT ON {table_name} TO {user_name}") + + with Then( + f"I successfully select from the cluster table as {user_name} from clickhouse3" + ): + output = node3.query( + f"SELECT * FROM cluster(sharded_cluster12, default.{table_name})", + settings=[("user", f"{user_name}")], + ).output + assert output == default, error() + + finally: + with Finally(f"I drop the table {table_name} from the cluster", flags=TE): + node.query( + f"DROP TABLE IF EXISTS {table_name} ON CLUSTER sharded_cluster12" + ) + + with And(f"I drop the user from the cluster", flags=TE): + node.query(f"DROP USER IF EXISTS {user_name} ON CLUSTER sharded_cluster") + + +@TestOutline(Feature) +@Name("table functions") +def feature(self, stress=None, node="clickhouse1"): + """Check the RBAC functionality of table functions.""" + self.context.node = self.context.cluster.node(node) + + if stress is not None: + self.context.stress = stress + + Scenario(run=remote) + Scenario(run=cluster) diff --git a/tests/testflows/regression.py b/tests/testflows/regression.py index bce8274c5cc..c4729296e02 100755 --- a/tests/testflows/regression.py +++ b/tests/testflows/regression.py @@ -10,9 +10,7 @@ @TestModule @Name("clickhouse") @ArgumentParser(argparser) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """ClickHouse regression.""" args = { "local": local, @@ -22,55 +20,50 @@ def regression( } self.context.stress = stress - self.context.clickhouse_version = clickhouse_version - - with Pool(8) as pool: - try: - Feature( - test=load("example.regression", "regression"), - parallel=True, - executor=pool, - )(**args) - Feature( - test=load("ldap.regression", "regression"), parallel=True, executor=pool - )(**args) - Feature( - test=load("rbac.regression", "regression"), parallel=True, executor=pool - )(**args) - Feature( - test=load("aes_encryption.regression", "regression"), - parallel=True, - executor=pool, - )( - **args - ) # TODO: fix it! - # Feature(test=load("map_type.regression", "regression"), parallel=True, executor=pool)(**args) # TODO: fix it! - Feature( - test=load("window_functions.regression", "regression"), - parallel=True, - executor=pool, - )( - **args - ) # TODO: fix it! - Feature( - test=load("datetime64_extended_range.regression", "regression"), - parallel=True, - executor=pool, - )(**args) - Feature( - test=load("kerberos.regression", "regression"), - parallel=True, - executor=pool, - )(**args) - Feature( - test=load("extended_precision_data_types.regression", "regression"), - parallel=True, - executor=pool, - )( - **args - ) # TODO: fix it! - finally: - join() + + try: + Feature(test=load("aes_encryption.regression", "regression"), parallel=True)( + **args + ) + + Feature( + test=load("datetime64_extended_range.regression", "regression"), + parallel=True, + )(**args) + + Feature(test=load("example.regression", "regression"), parallel=True)(**args) + + Feature( + test=load("extended_precision_data_types.regression", "regression"), + parallel=True, + )(**args) + + Feature( + test=load("ldap.authentication.regression", "regression"), parallel=True + )(**args) + + join() + + Feature( + test=load("ldap.external_user_directory.regression", "regression"), + parallel=True, + )(**args) + + join() + + Feature(test=load("ldap.role_mapping.regression", "regression"), parallel=True)( + **args + ) + + Feature(test=load("map_type.regression", "regression"), parallel=True)(**args) + + Feature(test=load("rbac.regression", "regression"), parallel=True)(**args) + + Feature(test=load("window_functions.regression", "regression"), parallel=True)( + **args + ) + finally: + join() if main(): diff --git a/tests/testflows/runner b/tests/testflows/runner index 0208512762c..1cf2a784ca0 100755 --- a/tests/testflows/runner +++ b/tests/testflows/runner @@ -14,7 +14,7 @@ DEFAULT_CLICKHOUSE_ROOT = os.path.abspath(os.path.join(CUR_FILE_DIR, "../../")) CURRENT_WORK_DIR = os.getcwd() CONTAINER_NAME = "clickhouse_testflows_tests" -DIND_TESTFLOWS_TESTS_IMAGE_NAME = "clickhouse/testflows-runner" +DIND_TESTFLOWS_TESTS_IMAGE_NAME = "altinityinfra/testflows-runner" def check_args_and_update_paths(args): if not os.path.isabs(args.binary): diff --git a/tests/testflows/window_functions/configs/clickhouse/config.d/macros.xml b/tests/testflows/window_functions/configs/clickhouse/config.d/macros.xml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/testflows/window_functions/configs/clickhouse/config.xml b/tests/testflows/window_functions/configs/clickhouse/config.xml new file mode 100644 index 00000000000..842a0573d49 --- /dev/null +++ b/tests/testflows/window_functions/configs/clickhouse/config.xml @@ -0,0 +1,448 @@ + + + + + + trace + /var/log/clickhouse-server/clickhouse-server.log + /var/log/clickhouse-server/clickhouse-server.err.log + 1000M + 10 + + + + 8123 + 9000 + + + + + + + + + /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 + + + + + + + + + 9009 + + + + + + + + 0.0.0.0 + + + + + + + + + + + + 4096 + 3 + + + 100 + + + + + + 8589934592 + + + 5368709120 + + + + /var/lib/clickhouse/ + + + /var/lib/clickhouse/tmp/ + + + /var/lib/clickhouse/user_files/ + + + /var/lib/clickhouse/access/ + + + + + + users.xml + + + + /var/lib/clickhouse/access/ + + + + + users.xml + + + default + + + + + + default + + + + + + + + + false + + + + + + + + localhost + 9000 + + + + + + + localhost + 9000 + + + + + localhost + 9000 + + + + + + + localhost + 9440 + 1 + + + + + + + localhost + 9000 + + + + + localhost + 1 + + + + + + + + + + + + + + + + + 3600 + + + + 3600 + + + 60 + + + + + + + + + + system + query_log
+ + toYYYYMM(event_date) + + 7500 +
+ + + + system + trace_log
+ + toYYYYMM(event_date) + 7500 +
+ + + + system + query_thread_log
+ toYYYYMM(event_date) + 7500 +
+ + + + system + part_log
+ toYYYYMM(event_date) + 7500 +
+ + + + + + + + + + + + + + *_dictionary.xml + + + + + + + + + + /clickhouse/task_queue/ddl + + + + + + + + + + + + + + + + click_cost + any + + 0 + 3600 + + + 86400 + 60 + + + + max + + 0 + 60 + + + 3600 + 300 + + + 86400 + 3600 + + + + + + /var/lib/clickhouse/format_schemas/ + + + +
diff --git a/tests/testflows/window_functions/configs/clickhouse/users.xml b/tests/testflows/window_functions/configs/clickhouse/users.xml new file mode 100644 index 00000000000..c7d0ecae693 --- /dev/null +++ b/tests/testflows/window_functions/configs/clickhouse/users.xml @@ -0,0 +1,133 @@ + + + + + + + + 10000000000 + + + 0 + + + random + + + + + 1 + + + + + + + + + + + + + ::/0 + + + + default + + + default + + + 1 + + + + + + + + + + + + + + + + + 3600 + + + 0 + 0 + 0 + 0 + 0 + + + + diff --git a/tests/testflows/window_functions/regression.py b/tests/testflows/window_functions/regression.py index f7fa116ead8..2a1cef7b111 100755 --- a/tests/testflows/window_functions/regression.py +++ b/tests/testflows/window_functions/regression.py @@ -12,6 +12,7 @@ SRS019_ClickHouse_Window_Functions, RQ_SRS_019_ClickHouse_WindowFunctions, ) +from helpers.common import check_clickhouse_version xfails = { "tests/:/frame clause/range frame/between expr following and expr following without order by error": [ @@ -116,33 +117,82 @@ "tests/:/funcs/lagInFrame/default offset": [ (Fail, "https://github.com/ClickHouse/ClickHouse/issues/23902") ], + "tests/:/time decayed funcs/exponentialTimeDecayed:/check decay length with INTERVAL": [ + (Fail, "not supported and should return an error") + ], + "tests/:/non-negative derivative func/check intervals/valid/:": [ + (Fail, "bug, LOGICAL_ERROR that needs to be investigated") + ], + "tests/:/non-negative derivative func/valid metric types/:": [ + (Fail, "bug, LOGICAL_ERROR that needs to be investigated") + ], + "tests/:/non-negative derivative func/valid timestamp types/:": [ + (Fail, "bug, LOGICAL_ERROR that needs to be investigated") + ], + "tests/:/non-negative derivative func/check one row per partition": [ + (Fail, "bug, LOGICAL_ERROR that needs to be investigated") + ], + "tests/:/non-negative derivative func/check over windows/:": [ + (Fail, "bug, LOGICAL_ERROR that needs to be investigated") + ], } xflags = {} +ffails = { + "tests/:/datatypes/low cardinality": ( + Skip, + "Server crashes on 21.9 and 21.10", + ( + lambda test: check_clickhouse_version(">=21.9")(test) + and check_clickhouse_version("<21.11")(test) + ), + ), + "tests/:/aggregate funcs/avgWeighted/:": ( + Skip, + "Server crashes on 21.9", + ( + lambda test: check_clickhouse_version(">=21.9")(test) + and check_clickhouse_version("<21.10")(test) + ), + ), + "tests/:/time decayed funcs": ( + Skip, + "Not implemented before 21.11", + check_clickhouse_version("<21.11"), + ), + "tests/:/non-negative derivative func": ( + Skip, + "Not implemented before 22.6", + check_clickhouse_version("<22.6"), + ), +} + @TestModule @ArgumentParser(argparser) @XFails(xfails) @XFlags(xflags) +@FFails(ffails) @Name("window functions") @Specifications(SRS019_ClickHouse_Window_Functions) @Requirements(RQ_SRS_019_ClickHouse_WindowFunctions("1.0")) -def regression( - self, local, clickhouse_binary_path, clickhouse_version=None, stress=None -): +def regression(self, local, clickhouse_binary_path, clickhouse_version, stress=None): """Window functions regression.""" nodes = {"clickhouse": ("clickhouse1", "clickhouse2", "clickhouse3")} + self.context.clickhouse_version = clickhouse_version + if stress is not None: self.context.stress = stress - self.context.clickhouse_version = clickhouse_version with Cluster( local, clickhouse_binary_path, nodes=nodes, - docker_compose_project_dir=os.path.join(current_dir(), "window_functions_env"), + docker_compose_project_dir=os.path.join( + current_dir(), os.path.basename(current_dir()) + "_env" + ), ) as cluster: self.context.cluster = cluster diff --git a/tests/testflows/window_functions/requirements/requirements.md b/tests/testflows/window_functions/requirements/requirements.md index 1079e7f8e91..4e70f0d3c91 100644 --- a/tests/testflows/window_functions/requirements/requirements.md +++ b/tests/testflows/window_functions/requirements/requirements.md @@ -196,6 +196,15 @@ * 3.8.2.2.1 [RQ.SRS-019.ClickHouse.WindowFunctions.AggregateFunctions.Combinators](#rqsrs-019clickhousewindowfunctionsaggregatefunctionscombinators) * 3.8.2.3 [Parametric](#parametric) * 3.8.2.3.1 [RQ.SRS-019.ClickHouse.WindowFunctions.AggregateFunctions.Parametric](#rqsrs-019clickhousewindowfunctionsaggregatefunctionsparametric) + * 3.8.2.4 [Time Decayed](#time-decayed) + * 3.8.2.4.1 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayed) + * 3.8.2.4.2 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedSum](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedsum) + * 3.8.2.4.3 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedMax](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedmax) + * 3.8.2.4.4 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedCount](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedcount) + * 3.8.2.4.5 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedAvg](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedavg) + * 3.8.3 [Specific](#specific) + * 3.8.3.1 [Non-negative Derivative](#non-negative-derivative) + * 3.8.3.1.1 [RQ.SRS-019.ClickHouse.WindowFunctions.Specific.NonNegativeDerivative](#rqsrs-019clickhousewindowfunctionsspecificnonnegativederivative) * 4 [References](#references) @@ -2331,6 +2340,124 @@ version: 1.0 * [uniqUpTo(N)(x)](https://clickhouse.com/docs/en/sql-reference/aggregate-functions/parametric-functions/#uniquptonx) * [sumMapFiltered(keys_to_keep)(keys, values)](https://clickhouse.com/docs/en/sql-reference/aggregate-functions/parametric-functions/#summapfilteredkeys-to-keepkeys-values) +##### Time Decayed + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed +version: 1.0 + +[ClickHouse] SHALL support using exponential time decayed aggregate functions over windows. + +* exponentialTimeDecayedSum +* exponentialTimeDecayedMax +* exponentialTimeDecayedCount +* exponentialTimeDecayedAvg + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedSum +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedSum` window function +that SHALL take a decay length parameter, a datetime input column and a numeric input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_output = current_input + previous_output * exp(-time_gap / decay_length)` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()(, ) +``` + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedMax +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedMax` window function +that SHALL take a decay length parameter, a datetime input column and a numeric input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_output = max(current_input, previous_output * exp(-time_gap / decay_length))` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()(, ) +``` + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedCount +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedCount` window function +that SHALL take a decay length parameter, a datetime input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_output = 1 + previous_count * exp(-time_gap / decay_length))` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()() +``` + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedAvg +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedAvg` window function +that SHALL take a decay length parameter, a datetime input column and a numeric input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_count = 1 + previous_count * exp(-time_gap / decay_length))` + +and + +`current_output = (current_input + previous_output * exp(-time_gap / decay_length)) / current_count` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()(, ) +``` + +#### Specific + +##### Non-negative Derivative + +###### RQ.SRS-019.ClickHouse.WindowFunctions.Specific.NonNegativeDerivative +version: 1.0 + +[ClickHouse] SHALL support `nonNegativeDerivative` window function that SHALL have +the following syntax: + +```SQL +nonNegativeDerivative(metric_column, timestamp_column[, INTERVAL X UNITS]) +``` + +which SHALL calculate non-negative derivative for given `metric_column` by `timestamp_column`. +The `INTERVAL` argument MAY be omitted, the default SHALL be `INTERVAL 1 SECOND`. + +The computed value SHALL be the following for each row: + +- `0` for $`1_{st}`$ row, +- $`{metric_i - metric_{i-1} \over timestamp_i - timestamp_{i-1}} * interval`$ for $`i_{th}`$ row. + ## References * [ClickHouse] diff --git a/tests/testflows/window_functions/requirements/requirements.py b/tests/testflows/window_functions/requirements/requirements.py index 3e9a8a46719..a686fa113d6 100644 --- a/tests/testflows/window_functions/requirements/requirements.py +++ b/tests/testflows/window_functions/requirements/requirements.py @@ -1,6 +1,6 @@ # These requirements were auto generated # from software requirements specification (SRS) -# document by TestFlows v1.6.210505.1133630. +# document by TestFlows v1.9.220620.1143643. # Do not edit by hand but re-generate instead # using 'tfs requirements generate' command. from testflows.core import Specification @@ -3464,6 +3464,184 @@ num="3.8.2.3.1", ) +RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed = Requirement( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support using exponential time decayed aggregate functions over windows.\n" + "\n" + "* exponentialTimeDecayedSum\n" + "* exponentialTimeDecayedMax\n" + "* exponentialTimeDecayedCount\n" + "* exponentialTimeDecayedAvg\n" + "\n" + ), + link=None, + level=5, + num="3.8.2.4.1", +) + +RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedSum = Requirement( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedSum", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support `exponentialTimeDecayedSum` window function\n" + "that SHALL take a decay length parameter, a datetime input column and a numeric input column.\n" + "\n" + "It SHALL update as \n" + "\n" + "`time_gap = current_time - previous_time`\n" + "\n" + "and \n" + "\n" + "`current_output = current_input + previous_output * exp(-time_gap / decay_length)`\n" + "\n" + "The function SHALL have the following syntax\n" + "\n" + "```sql\n" + "exponentialTimeDecayedSum()(, )\n" + "```\n" + "\n" + ), + link=None, + level=5, + num="3.8.2.4.2", +) + +RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedMax = Requirement( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedMax", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support `exponentialTimeDecayedMax` window function\n" + "that SHALL take a decay length parameter, a datetime input column and a numeric input column.\n" + "\n" + "It SHALL update as \n" + "\n" + "`time_gap = current_time - previous_time`\n" + "\n" + "and\n" + "\n" + "`current_output = max(current_input, previous_output * exp(-time_gap / decay_length))`\n" + "\n" + "The function SHALL have the following syntax\n" + "\n" + "```sql\n" + "exponentialTimeDecayedSum()(, )\n" + "```\n" + "\n" + ), + link=None, + level=5, + num="3.8.2.4.3", +) + +RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedCount = Requirement( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedCount", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support `exponentialTimeDecayedCount` window function\n" + "that SHALL take a decay length parameter, a datetime input column.\n" + "\n" + "It SHALL update as \n" + "\n" + "`time_gap = current_time - previous_time`\n" + "\n" + "and\n" + "\n" + "`current_output = 1 + previous_count * exp(-time_gap / decay_length))`\n" + "\n" + "The function SHALL have the following syntax\n" + "\n" + "```sql\n" + "exponentialTimeDecayedSum()()\n" + "```\n" + "\n" + ), + link=None, + level=5, + num="3.8.2.4.4", +) + +RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedAvg = Requirement( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedAvg", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support `exponentialTimeDecayedAvg` window function\n" + "that SHALL take a decay length parameter, a datetime input column and a numeric input column.\n" + "\n" + "It SHALL update as \n" + "\n" + "`time_gap = current_time - previous_time`\n" + "\n" + "and \n" + "\n" + "`current_count = 1 + previous_count * exp(-time_gap / decay_length))`\n" + "\n" + "and\n" + "\n" + "`current_output = (current_input + previous_output * exp(-time_gap / decay_length)) / current_count`\n" + "\n" + "The function SHALL have the following syntax\n" + "\n" + "```sql\n" + "exponentialTimeDecayedSum()(, )\n" + "```\n" + "\n" + ), + link=None, + level=5, + num="3.8.2.4.5", +) + +RQ_SRS_019_ClickHouse_WindowFunctions_Specific_NonNegativeDerivative = Requirement( + name="RQ.SRS-019.ClickHouse.WindowFunctions.Specific.NonNegativeDerivative", + version="1.0", + priority=None, + group=None, + type=None, + uid=None, + description=( + "[ClickHouse] SHALL support `nonNegativeDerivative` window function that SHALL have\n" + "the following syntax:\n" + "\n" + "```SQL\n" + "nonNegativeDerivative(metric_column, timestamp_column[, INTERVAL X UNITS])\n" + "```\n" + "\n" + "which SHALL calculate non-negative derivative for given `metric_column` by `timestamp_column`.\n" + "The `INTERVAL` argument MAY be omitted, the default SHALL be `INTERVAL 1 SECOND`.\n" + "\n" + "The computed value SHALL be the following for each row:\n" + "\n" + "- `0` for 1st row,\n" + "- ${metric_i - metric_{i-1} \\over timestamp_i - timestamp_{i-1}} * interval$ for $i_th$ row.\n" + "\n" + ), + link=None, + level=5, + num="3.8.3.1.1", +) + SRS019_ClickHouse_Window_Functions = Specification( name="SRS019 ClickHouse Window Functions", description=None, @@ -4208,6 +4386,39 @@ level=5, num="3.8.2.3.1", ), + Heading(name="Time Decayed", level=4, num="3.8.2.4"), + Heading( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed", + level=5, + num="3.8.2.4.1", + ), + Heading( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedSum", + level=5, + num="3.8.2.4.2", + ), + Heading( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedMax", + level=5, + num="3.8.2.4.3", + ), + Heading( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedCount", + level=5, + num="3.8.2.4.4", + ), + Heading( + name="RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedAvg", + level=5, + num="3.8.2.4.5", + ), + Heading(name="Specific", level=3, num="3.8.3"), + Heading(name="Non-negative Derivative", level=4, num="3.8.3.1"), + Heading( + name="RQ.SRS-019.ClickHouse.WindowFunctions.Specific.NonNegativeDerivative", + level=5, + num="3.8.3.1.1", + ), Heading(name="References", level=1, num="4"), ), requirements=( @@ -4344,6 +4555,12 @@ RQ_SRS_019_ClickHouse_WindowFunctions_AggregateFunctions, RQ_SRS_019_ClickHouse_WindowFunctions_AggregateFunctions_Combinators, RQ_SRS_019_ClickHouse_WindowFunctions_AggregateFunctions_Parametric, + RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed, + RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedSum, + RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedMax, + RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedCount, + RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed_ExponentialTimeDecayedAvg, + RQ_SRS_019_ClickHouse_WindowFunctions_Specific_NonNegativeDerivative, ), content=""" # SRS019 ClickHouse Window Functions @@ -4544,6 +4761,15 @@ * 3.8.2.2.1 [RQ.SRS-019.ClickHouse.WindowFunctions.AggregateFunctions.Combinators](#rqsrs-019clickhousewindowfunctionsaggregatefunctionscombinators) * 3.8.2.3 [Parametric](#parametric) * 3.8.2.3.1 [RQ.SRS-019.ClickHouse.WindowFunctions.AggregateFunctions.Parametric](#rqsrs-019clickhousewindowfunctionsaggregatefunctionsparametric) + * 3.8.2.4 [Time Decayed](#time-decayed) + * 3.8.2.4.1 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayed) + * 3.8.2.4.2 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedSum](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedsum) + * 3.8.2.4.3 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedMax](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedmax) + * 3.8.2.4.4 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedCount](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedcount) + * 3.8.2.4.5 [RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedAvg](#rqsrs-019clickhousewindowfunctionsexponentialtimedecayedexponentialtimedecayedavg) + * 3.8.3 [Specific](#specific) + * 3.8.3.1 [Non-negative Derivative](#non-negative-derivative) + * 3.8.3.1.1 [RQ.SRS-019.ClickHouse.WindowFunctions.Specific.NonNegativeDerivative](#rqsrs-019clickhousewindowfunctionsspecificnonnegativederivative) * 4 [References](#references) @@ -6679,6 +6905,124 @@ * [uniqUpTo(N)(x)](https://clickhouse.com/docs/en/sql-reference/aggregate-functions/parametric-functions/#uniquptonx) * [sumMapFiltered(keys_to_keep)(keys, values)](https://clickhouse.com/docs/en/sql-reference/aggregate-functions/parametric-functions/#summapfilteredkeys-to-keepkeys-values) +##### Time Decayed + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed +version: 1.0 + +[ClickHouse] SHALL support using exponential time decayed aggregate functions over windows. + +* exponentialTimeDecayedSum +* exponentialTimeDecayedMax +* exponentialTimeDecayedCount +* exponentialTimeDecayedAvg + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedSum +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedSum` window function +that SHALL take a decay length parameter, a datetime input column and a numeric input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_output = current_input + previous_output * exp(-time_gap / decay_length)` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()(, ) +``` + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedMax +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedMax` window function +that SHALL take a decay length parameter, a datetime input column and a numeric input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_output = max(current_input, previous_output * exp(-time_gap / decay_length))` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()(, ) +``` + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedCount +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedCount` window function +that SHALL take a decay length parameter, a datetime input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_output = 1 + previous_count * exp(-time_gap / decay_length))` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()() +``` + +###### RQ.SRS-019.ClickHouse.WindowFunctions.ExponentialTimeDecayed.ExponentialTimeDecayedAvg +version: 1.0 + +[ClickHouse] SHALL support `exponentialTimeDecayedAvg` window function +that SHALL take a decay length parameter, a datetime input column and a numeric input column. + +It SHALL update as + +`time_gap = current_time - previous_time` + +and + +`current_count = 1 + previous_count * exp(-time_gap / decay_length))` + +and + +`current_output = (current_input + previous_output * exp(-time_gap / decay_length)) / current_count` + +The function SHALL have the following syntax + +```sql +exponentialTimeDecayedSum()(, ) +``` + +#### Specific + +##### Non-negative Derivative + +###### RQ.SRS-019.ClickHouse.WindowFunctions.Specific.NonNegativeDerivative +version: 1.0 + +[ClickHouse] SHALL support `nonNegativeDerivative` window function that SHALL have +the following syntax: + +```SQL +nonNegativeDerivative(metric_column, timestamp_column[, INTERVAL X UNITS]) +``` + +which SHALL calculate non-negative derivative for given `metric_column` by `timestamp_column`. +The `INTERVAL` argument MAY be omitted, the default SHALL be `INTERVAL 1 SECOND`. + +The computed value SHALL be the following for each row: + +- `0` for 1st row, +- ${metric_i - metric_{i-1} \over timestamp_i - timestamp_{i-1}} * interval$ for $i_th$ row. + ## References * [ClickHouse] diff --git a/tests/testflows/window_functions/tests/aggregate_funcs.py b/tests/testflows/window_functions/tests/aggregate_funcs.py index faac8a84c49..13dc90369ca 100644 --- a/tests/testflows/window_functions/tests/aggregate_funcs.py +++ b/tests/testflows/window_functions/tests/aggregate_funcs.py @@ -1,3 +1,4 @@ +from tracemalloc import Snapshot from testflows.core import * from testflows.asserts import values, error, snapshot @@ -79,11 +80,25 @@ ) def aggregate_funcs_over_rows_frame(self, func): """Checking aggregate funcs over rows frame.""" + snapshot_name = ( + "/window functions" + + current() + .name.replace(f"{sep}non distributed{sep}", ":") + .replace(f"{sep}distributed{sep}", ":") + .split("/window functions", 1)[-1] + ) + + if ( + func.startswith("studentTTest") or func.startswith("welchTTest") + ) and check_clickhouse_version(">=22")(self): + snapshot_name += "/version>=22" + execute_query( f""" SELECT {func} OVER (ORDER BY salary, empno ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) AS func FROM empsalary - """ + """, + snapshot_name=snapshot_name, ) @@ -353,6 +368,81 @@ def ungrouped_aggregate_over_empty_row_set(self): ) +@TestScenario +def avgWeighted(self): + """Check special case of using `avgWeighted` function with Decimal and mixed types + when used over a window function. + """ + with Example("decimal weight"): + expected = convert_output( + """ + avg + ------- + nan + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + """ + ) + + execute_query( + "SELECT avgWeighted(a, toDecimal64(c, 9)) OVER (PARTITION BY c) AS avg FROM (SELECT number AS a, number AS c FROM numbers(10))", + expected=expected, + ) + + with Example("decimal value and weight"): + expected = convert_output( + """ + avg + ------- + nan + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + """ + ) + + execute_query( + "SELECT avgWeighted(toDecimal64(a, 4), toDecimal64(c, 9)) OVER (PARTITION BY c) AS avg FROM (SELECT number AS a, number AS c FROM numbers(10))", + expected=expected, + ) + + with Example("float value and decimal weight from table"): + expected = convert_output( + """ + avg + ------- + 5000 + 3900 + 4800 + 4800 + 3500 + 4200 + 6000 + 4500 + 5200 + 5200 + """ + ) + + execute_query( + "SELECT avgWeighted(toFloat64(salary) + 0.02, toDecimal64(empno, 9)) OVER (PARTITION BY empno) AS avg FROM (SELECT * FROM empsalary ORDER BY empno)", + expected=expected, + ) + + @TestFeature @Name("aggregate funcs") @Requirements(RQ_SRS_019_ClickHouse_WindowFunctions_AggregateFunctions("1.0")) diff --git a/tests/testflows/window_functions/tests/common.py b/tests/testflows/window_functions/tests/common.py index b0bca328e4d..ab2a6143a09 100644 --- a/tests/testflows/window_functions/tests/common.py +++ b/tests/testflows/window_functions/tests/common.py @@ -5,9 +5,57 @@ from testflows.core import * from testflows.core.name import basename, parentname +from testflows._core.name import sep from testflows._core.testtype import TestSubType from testflows.asserts import values, error, snapshot +from helpers.common import check_clickhouse_version, getuid + +interval_periods = [ + "SECOND", + "MINUTE", + "HOUR", + "DAY", + "WEEK", + "MONTH", + "QUARTER", + "YEAR", +] + + +def windows(order_by): + return [ + # frame with all rows + "" + # rows + "ROWS BETWEEN CURRENT ROW AND CURRENT ROW", + "ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING", + "ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING", + "ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW", + "ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING", + "ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING", + "ROWS BETWEEN 1 PRECEDING AND CURRENT ROW", + "ROWS BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING", + "ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING", + "ROWS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING", + # range + "RANGE BETWEEN CURRENT ROW AND CURRENT ROW", + "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING", + "RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW", + "RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING", + # range with order by + f"ORDER BY {order_by} RANGE BETWEEN CURRENT ROW AND CURRENT ROW", + f"ORDER BY {order_by} RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING", + f"ORDER BY {order_by} RANGE BETWEEN CURRENT ROW AND 1 FOLLOWING", + f"ORDER BY {order_by} RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW", + f"ORDER BY {order_by} RANGE BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING", + f"ORDER BY {order_by} RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING", + f"ORDER BY {order_by} RANGE BETWEEN 1 PRECEDING AND CURRENT ROW", + f"ORDER BY {order_by} RANGE BETWEEN 1 PRECEDING AND UNBOUNDED FOLLOWING", + f"ORDER BY {order_by} RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING", + f"ORDER BY {order_by} RANGE BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING", + ] + def window_frame_error(): return (36, "Exception: Window frame") @@ -44,8 +92,12 @@ def syntax_error(): return (62, "Exception: Syntax error") -def groups_frame_error(): - return (48, "Exception: Window frame 'Groups' is not implemented") +def groups_frame_error(test): + return ( + (48, "Exception: Window frame 'GROUPS' is not implemented") + if check_clickhouse_version("<21.11")(test) + else (48, "Exception: Window frame 'Groups' is not implemented") + ) def getuid(): @@ -70,15 +122,33 @@ def convert_output(s): def execute_query( - sql, expected=None, exitcode=None, message=None, format="TabSeparatedWithNames" + sql, + expected=None, + exitcode=None, + message=None, + no_checks=False, + snapshot_name=None, + format="TabSeparatedWithNames", ): """Execute SQL query and compare the output to the snapshot.""" - name = basename(current().name) + if snapshot_name is None: + snapshot_name = ( + "/window functions" + + current() + .name.replace(f"{sep}non distributed{sep}", ":") + .replace(f"{sep}distributed{sep}", ":") + .split("/window functions", 1)[-1] + ) with When("I execute query", description=sql): r = current().context.node.query( - sql + " FORMAT " + format, exitcode=exitcode, message=message + sql + " FORMAT " + format, + exitcode=exitcode, + message=message, + no_checks=no_checks, ) + if no_checks: + return r if message is None: if expected is not None: @@ -91,7 +161,7 @@ def execute_query( snapshot( "\n" + r.output.strip() + "\n", "tests", - name=name, + name=snapshot_name, encoder=str, ) ), error() @@ -210,6 +280,76 @@ def datetimes_table(self, name="datetimes", distributed=False): return table +@TestStep(Given) +def datetimes_table_from_data_query( + self, data_query, name="datetimes2", distributed=False +): + """Create datetimes table that is populated + automatically based on the passed SELECT data generating query. + + For example, + + ```data_query=("SELECT number AS id, " + "toDate('2020-01-01') + number AS f_date, " + "toDate32('2020-01-01') + number AS f_date32, " + "toDateTime('2020-01-01', 'CET') + number AS f_timestamptz, " + "toDateTime('2020-01-01') + number AS f_timestamp, " + "toDateTime64('2020-01-01', 9, 'CET') + number AS f_timestamp64tz, " + "toDateTime64('2020-01-01', 9) + number AS f_timestamp64 " + "FROM numbers(10)") + ``` + """ + table = None + + if not distributed: + with By("creating table"): + sql = """ + CREATE TABLE {name} ( + id UInt32, + f_date Date, + --f_date32 Date32, + f_timestamptz DateTime('CET'), + f_timestamp DateTime, + f_timestamp64tz DateTime64(9, 'CET'), + f_timestamp64 DateTime64 + ) ENGINE = MergeTree() ORDER BY tuple() + """ + table = create_table(name=name, statement=sql) + + with And("populating table with data"): + sql = f"INSERT INTO {name} {data_query}" + self.context.node.query(sql) + + else: + with By("creating table"): + sql = """ + CREATE TABLE {name} ON CLUSTER sharded_cluster ( + id UInt32, + f_timestamptz DateTime('CET'), + f_timestamp DateTime + ) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{{shard}}/{name}', '{{replica}}') ORDER BY tuple() + """ + create_table( + name=name + "_source", statement=sql, on_cluster="sharded_cluster" + ) + + with And("a distributed table"): + sql = ( + "CREATE TABLE {name} AS " + + name + + "_source" + + " ENGINE = Distributed(sharded_cluster, default, " + + f"{name + '_source'}, id % toUInt8(getMacro('shard')))" + ) + table = create_table(name=name, statement=sql) + + with And("populating table with data"): + sql = f"INSERT INTO {name} {data_query}" + self.context.node.query(sql) + + return table + + @TestStep(Given) def numerics_table(self, name="numerics", distributed=False): """Create numerics tables.""" @@ -465,3 +605,53 @@ def create_table(self, name, statement, on_cluster=False): node.query(f"DROP TABLE IF EXISTS {name} ON CLUSTER {on_cluster}") else: node.query(f"DROP TABLE IF EXISTS {name}") + + +@TestStep(Given) +def allow_experimental_window_functions(self): + """Set allow_experimental_window_functions = 1""" + setting = ("allow_experimental_window_functions", 1) + default_query_settings = None + + try: + with By( + "adding allow_experimental_window_functions to the default query settings" + ): + default_query_settings = getsattr( + current().context, "default_query_settings", [] + ) + default_query_settings.append(setting) + yield + finally: + with Finally( + "I remove allow_experimental_window_functions from the default query settings" + ): + if default_query_settings: + try: + default_query_settings.pop(default_query_settings.index(setting)) + except ValueError: + pass + + +@TestStep(Given) +def allow_distributed_product_mode(self): + """Set distributed_product_mode = 'allow'""" + setting = ("distributed_product_mode", "allow") + default_query_settings = None + + try: + with By("adding distributed_product_mode to the default query settings"): + default_query_settings = getsattr( + current().context, "default_query_settings", [] + ) + default_query_settings.append(setting) + yield + finally: + with Finally( + "I remove distributed_product_mode from the default query settings" + ): + if default_query_settings: + try: + default_query_settings.pop(default_query_settings.index(setting)) + except ValueError: + pass diff --git a/tests/testflows/window_functions/tests/datatypes.py b/tests/testflows/window_functions/tests/datatypes.py new file mode 100644 index 00000000000..e6afcc9dede --- /dev/null +++ b/tests/testflows/window_functions/tests/datatypes.py @@ -0,0 +1,339 @@ +from testflows.core import * +from testflows.asserts import values, error, snapshot + +from window_functions.requirements import * +from window_functions.tests.common import * + + +@TestScenario +def low_cardinality(self): + """Check using LowCardinality data type.""" + expected = convert_output( + """ + ma + ----- + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + """ + ) + + # note((lambda test: check_clickhouse_version("=21.10.5.3")(test))(self)) + execute_query( + "SELECT max(a) OVER () AS ma FROM (SELECT toLowCardinality(toString(number % 2 + 1)) AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def datetime64(self): + """Check using DateTime64 data type.""" + expected = convert_output( + """ + ma + --------------------------- + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + 1972-11-07 19:00:00.00000 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toDateTime64(number*10000000,5) AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def datetime(self): + """Check using DateTime data type.""" + expected = convert_output( + """ + ma + --------------------- + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + 1972-11-07 19:00:00 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toDateTime(number*10000000) AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def date(self): + """Check using Date data type.""" + expected = convert_output( + """ + ma + ------------ + 1972-11-07 + 1972-11-07 + 1972-11-07 + 1972-11-07 + 1972-11-07 + 1972-11-07 + 1972-11-07 + 1972-11-07 + 1972-11-07 + 1972-11-07 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toDate(number*10000000) AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def enum(self): + """Check using Enum data type.""" + expected = convert_output( + """ + ma + ---- + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT CAST(a, 'Enum(\\'1\\' = 1, \\'2\\' = 2)') AS a FROM (SELECT toString(number % 2 + 1) AS a FROM numbers(10)))", + expected=expected, + ) + + +@TestScenario +def decimal32(self): + """Check using Decimal32 data type.""" + + if check_clickhouse_version("<21.9")(self): + expected = convert_output( + """ + ma + ------ + 1.80 + 1.80 + 1.80 + 1.80 + 1.80 + 1.80 + 1.80 + 1.80 + 1.80 + 1.80 + """ + ) + else: + expected = convert_output( + """ + ma + ------ + 1.8 + 1.8 + 1.8 + 1.8 + 1.8 + 1.8 + 1.8 + 1.8 + 1.8 + 1.8 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toDecimal32(number*0.2,2) AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def string(self): + """Check using String data type.""" + expected = convert_output( + """ + ma + ------ + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toString(number % 2 + 1) AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def fixed_string(self): + """Check using FixedString data type.""" + expected = convert_output( + """ + ma + ------ + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + 2\\0\\0 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toFixedString(toString(number % 2 + 1), 3) AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def uuid(self): + """Check using UUID data type.""" + expected = convert_output( + """ + ma + ------ + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + 61f0c404-5cb3-11e7-907b-a6006ad3dba0 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toUUID('61f0c404-5cb3-11e7-907b-a6006ad3dba0') AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def ipv4(self): + """Check using IPv4 data type.""" + expected = convert_output( + """ + ma + ------ + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + 171.225.130.45 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toIPv4('171.225.130.45') AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def ipv6(self): + """Check using IPv6 data type.""" + expected = convert_output( + """ + ma + ------ + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + 2001:438:ffff::407d:1bc1 + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM ( SELECT toIPv6('2001:438:ffff::407d:1bc1') AS a FROM numbers(10))", + expected=expected, + ) + + +@TestScenario +def map(self): + """Check using Map data type.""" + expected = convert_output( + """ + ma + ------ + {'hello2':2} + {'hello2':2} + """ + ) + + execute_query( + "SELECT max(a) OVER () AS ma FROM (SELECT m AS a FROM values('m Map(String, UInt64)', map('hello',1), map('hello2',2)))", + expected=expected, + ) + + +@TestFeature +@Name("datatypes") +@Requirements() +def feature(self): + """Check using aggregate function over windows with different data types.""" + + for scenario in loads(current_module(), Scenario): + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/window_functions/tests/errors.py b/tests/testflows/window_functions/tests/errors.py index ee9452eecba..0837d2a5050 100644 --- a/tests/testflows/window_functions/tests/errors.py +++ b/tests/testflows/window_functions/tests/errors.py @@ -1,4 +1,5 @@ from testflows.core import * +from helpers.common import check_clickhouse_version from window_functions.requirements import * from window_functions.tests.common import * @@ -45,12 +46,21 @@ def error_window_function_in_where(self): @TestScenario def error_window_function_in_join(self): """Check that trying to use window function in `JOIN` returns an error.""" - exitcode = 147 - message = "DB::Exception: Cannot get JOIN keys from JOIN ON section: row_number() OVER (ORDER BY salary ASC) < 10" + note(self.context.clickhouse_version) + + if self.context.distributed: + allow_distributed_product_mode() + + exitcode = 48 if check_clickhouse_version("<21.9")(self) else 147 + message = ( + "DB::Exception: JOIN ON inequalities are not supported" + if check_clickhouse_version("<21.9")(self) + else "DB::Exception: Cannot get JOIN keys from JOIN ON section" + ) sql = "SELECT * FROM empsalary INNER JOIN tenk1 ON row_number() OVER (ORDER BY salary) < 10" - with When("I execute query", description=sql): + with When(f"I execute query", description=sql): r = current().context.node.query(sql, exitcode=exitcode, message=message) @@ -58,7 +68,7 @@ def error_window_function_in_join(self): def error_window_function_in_group_by(self): """Check that trying to use window function in `GROUP BY` returns an error.""" exitcode = 47 - message = "DB::Exception: Unknown identifier: row_number() OVER (ORDER BY salary ASC); there are columns" + message = "DB::Exception: Unknown identifier" sql = "SELECT rank() OVER (ORDER BY 1), count(*) FROM empsalary GROUP BY row_number() OVER (ORDER BY salary) < 10" diff --git a/tests/testflows/window_functions/tests/feature.py b/tests/testflows/window_functions/tests/feature.py index c1454a419e9..a9b7c8448c6 100755 --- a/tests/testflows/window_functions/tests/feature.py +++ b/tests/testflows/window_functions/tests/feature.py @@ -32,6 +32,10 @@ def feature(self, distributed, node="clickhouse1"): self.context.distributed = distributed self.context.node = self.context.cluster.node(node) + if check_clickhouse_version("<21.9")(self): + with Given("I allow experimental window functions"): + allow_experimental_window_functions() + with Given("employee salary table"): empsalary_table(distributed=distributed) @@ -44,6 +48,21 @@ def feature(self, distributed, node="clickhouse1"): with And("datetimes table"): datetimes_table(distributed=distributed) + with And("datetimes2 table populated using data query"): + datetimes_table_from_data_query( + data_query=( + "SELECT number AS id, " + "toDate('2020-01-01') + number AS f_date, " + # "toDate32('2020-01-01') + number AS f_date32, " + "toDateTime('2020-01-01', 'CET') + number AS f_timestamptz, " + "toDateTime('2020-01-01') + number AS f_timestamp, " + "toDateTime64('2020-01-01', 9, 'CET') + number AS f_timestamp64tz, " + "toDateTime64('2020-01-01', 9) + number AS f_timestamp64 " + "FROM numbers(10000)" + ), + name="datetimes2", + ) + with And("t1 table"): t1_table(distributed=distributed) @@ -55,5 +74,10 @@ def feature(self, distributed, node="clickhouse1"): Feature(run=load("window_functions.tests.over_clause", "feature"), flags=TE) Feature(run=load("window_functions.tests.funcs", "feature"), flags=TE) Feature(run=load("window_functions.tests.aggregate_funcs", "feature"), flags=TE) + Feature(run=load("window_functions.tests.time_decayed_funcs", "feature"), flags=TE) Feature(run=load("window_functions.tests.errors", "feature"), flags=TE) Feature(run=load("window_functions.tests.misc", "feature"), flags=TE) + Feature(run=load("window_functions.tests.datatypes", "feature"), flags=TE) + Feature( + run=load("window_functions.tests.non_negative_derivative", "feature"), flags=TE + ) diff --git a/tests/testflows/window_functions/tests/misc.py b/tests/testflows/window_functions/tests/misc.py index 5cb579c3954..73a9ce66a54 100644 --- a/tests/testflows/window_functions/tests/misc.py +++ b/tests/testflows/window_functions/tests/misc.py @@ -222,7 +222,7 @@ def from_subquery(self): @TestScenario def groups_frame(self): """Check using `GROUPS` frame.""" - exitcode, message = groups_frame_error() + exitcode, message = groups_frame_error(self) expected = convert_output( """ diff --git a/tests/testflows/window_functions/tests/non_negative_derivative.py b/tests/testflows/window_functions/tests/non_negative_derivative.py new file mode 100644 index 00000000000..3db5d570dce --- /dev/null +++ b/tests/testflows/window_functions/tests/non_negative_derivative.py @@ -0,0 +1,357 @@ +import textwrap + +from testflows.core import * + +from helpers.common import check_clickhouse_version +from window_functions.requirements import * +from window_functions.tests.common import * + + +@TestScenario +def null_values(self): + """Check NULL values in either metric or timestamp column.""" + with Example(f"metric column"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER () AS nnd FROM values('id Int8, metric Nullable(Float64), ts DateTime', (1,1,'2022-12-12 00:00:00'),(1,null,'2022-12-12 00:00:01'))", + exitcode=36, + message="Exception: Argument 0 must be a number", + ) + + with Example("timestamp column"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER () AS nnd FROM values('id Int8, metric Float64, ts Nullable(DateTime)', (1,1,'2022-12-12 00:00:00'),(1,1,null))", + exitcode=36, + message="Exception: Argument 1 must be DateTime or DateTime64", + ) + + +@TestScenario +def division_by_zero(self): + """Check division by zero when two timestamps are the same.""" + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id) AS nnd FROM values('id Int8, metric Float64, ts DateTime', (1,1,'2022-12-12 00:00:00'),(2,1,'2022-12-12 00:00:00'))", + ) + + +@TestScenario +def division_by_tiny(self): + """Check division by tiny difference between consecutive timestamps.""" + with Example("numerator is non-zero"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id) AS nnd FROM values('id Int8, metric Float64, ts DateTime64(9)', (1,1,'2022-12-12 00:00:00'), (2,2,'2022-12-12 00:00:00.000000001'),(3,3,'2022-12-12 00:00:00.000000002'))", + ) + + with Example("numerator is zero"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id) AS nnd FROM values('id Int8, metric Float64, ts DateTime64(9)', (1,1,'2022-12-12 00:00:00'), (2,1,'2022-12-12 00:00:00.000000001'),(3,1,'2022-12-12 00:00:00.000000002'))", + ) + + +@TestScenario +def check_negative_result(self): + """Check that negative result is converted to 0.""" + expected = convert_output( + """ + id | metric | ts | nnd + ---+--------+-------------------------------+----------------------- + 1 | 1 | 2022-12-12 00:00:02.000000000 | 0 + 2 | 2 | 2022-12-12 00:00:01.000000000 | 0 + 3 | 3 | 2022-12-12 00:00:00.000000000 | 0 + """ + ) + + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id ASC) AS nnd FROM values('id Int8, metric Float64, ts DateTime64(9)', (1,1,'2022-12-12 00:00:02'), (2,2,'2022-12-12 00:00:01'),(3,3,'2022-12-12 00:00:00'))", + expected=expected, + ) + + +@TestScenario +def wrong_number_of_arguments_or_types(self): + """Check passing wrong number of arguments or types.""" + exitcode = 36 + message = "Exception: Function nonNegativeDerivative takes 2 or 3 arguments" + table = "values('id Int8, metric Float64, ts DateTime64(9)', (1,1,'2022-12-12 00:00:00'), (2,2,'2022-12-12 00:00:01'),(3,3,'2022-12-12 00:00:02'))" + + with Example("missing timestamp"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric) OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message=message, + ) + + with Example("missing metric"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(ts) OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message=message, + ) + + with Example("missing metric with interval"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(INTERVAL 3 SECOND) OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message=message, + ) + + with Example("missing timestamp with interval"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, INTERVAL 3 SECOND) OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message="Exception: Argument 1 must be DateTime or DateTime64", + ) + + with Example("empty"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative() OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message=message, + ) + + with Example("invalid interval type"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts, 2) OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message="Exception: Argument 2 must be an INTERVAL", + ) + + with Example("invalid metric type"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(ts, ts) OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message="Exception: Argument 0 must be a number", + ) + + with Example("invalid timestamp type"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, metric) OVER (ORDER BY id ASC) AS nnd FROM {table}", + exitcode=exitcode, + message="Exception: Argument 1 must be DateTime or DateTime64", + ) + + +@TestScenario +def zero_interval(self): + """Check using zero second interval.""" + expected = convert_output( + """ + id | metric | ts | nnd + ---+--------+---------------------+----- + 1 | 1 | 2022-12-12 00:00:00 | 0 + 2 | 2 | 2022-12-12 00:00:01 | 0 + 3 | 3 | 2022-12-12 00:00:02 | 0 + """ + ) + + execute_query( + "SELECT id, metric, ts, nonNegativeDerivative(metric, ts, INTERVAL 0 SECOND) OVER (ORDER BY id ASC) AS nnd FROM values('id Int8, metric Float64, ts DateTime64(0)', (1,1,'2022-12-12 00:00:00'), (2,2,'2022-12-12 00:00:01'),(3,3,'2022-12-12 00:00:02'))", + expected=expected, + ) + + +@TestScenario +def empty_table(self): + """Check against empty table.""" + node = self.context.node + table = f"table_{getuid()}" + + with Given("I create empty table"): + node.query( + f"CREATE TABLE {table} (id Int8, metric Float64, ts DateTime64(9)) ENGINE=MergeTree() ORDER BY tuple()" + ) + + try: + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id ASC) AS nnd FROM {table}" + ) + finally: + with Finally("drop table"): + node.query(f"DROP TABLE IF EXISTS {table}") + + +@TestScenario +def check_intervals(self): + with Check("valid"): + valid = ("SECOND", "MINUTE", "HOUR", "DAY", "WEEK") + + for interval in valid: + with Example(f"{interval}", flags=TE): + execute_query( + f"SELECT id, f_timestamp, nonNegativeDerivative(id, f_timestamp, INTERVAL 1 {interval}) OVER (ROWS BETWEEN CURRENT ROW AND CURRENT ROW) AS nnd FROM (SELECT * FROM datetimes2 ORDER BY f_timestamp LIMIT 10)" + ) + + with Check("invalid"): + invalid = ( + "MONTH", + "QUARTER", + "YEAR", + ) + + for interval in invalid: + with Example(f"{interval}", flags=TE): + execute_query( + f"SELECT id, f_timestamp, nonNegativeDerivative(id, f_timestamp, INTERVAL 1 {interval}) OVER (ROWS BETWEEN CURRENT ROW AND CURRENT ROW) AS nnd FROM (SELECT * FROM datetimes2 ORDER BY f_timestamp LIMIT 10)", + exitcode=43, + message="Exception: The INTERVAL must be a week or shorter", + ) + + +@TestScenario +def check_one_row_per_partition(self): + """Check when there is only 1 row per partition.""" + execute_query( + f"SELECT id, f_timestamp, nonNegativeDerivative(id, f_timestamp) OVER (PARTITION BY id) AS nnd FROM datetimes2 ORDER BY id LIMIT 10" + ) + + +@TestScenario +def check_over_windows(self): + """Check function over different window frames.""" + for window in windows(order_by="id"): + with Check(f"{window}", flags=TE): + execute_query( + f"SELECT id, f_timestamp, nonNegativeDerivative(id, f_timestamp, INTERVAL 1 SECOND) OVER (PARTITION BY toStartOfHour(f_timestamp) {window}) AS nnd FROM datetimes2 ORDER BY id LIMIT 10" + ) + + +@TestScenario +def valid_metric_types(self): + """Check valid numerical metric types.""" + datatypes = ( + "Float32", + "Float64", + "UInt8", + "UInt16", + "UInt32", + "UInt64", + "Int8", + "Int16", + "Int32", + "Int64", + "Decimal32(4)", + "Decimal64(4)", + "Decimal128(4)", + ) + + for datatype in datatypes: + with Example(f"{datatype}"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id ASC) AS nnd FROM values('id Int8, metric {datatype}, ts DateTime64(0)', (1,1,'2022-12-12 00:00:00'), (2,2,'2022-12-12 00:00:01'),(3,3,'2022-12-12 00:00:02'))" + ) + + +@TestScenario +def valid_timestamp_types(self): + """Check valid timestamp types.""" + datatypes = ("DateTime", "DateTime64(0)", "DateTime64(3, EST)") + + for datatype in datatypes: + with Example(f"{datatype}"): + execute_query( + f"SELECT id, metric, ts, nonNegativeDerivative(metric, ts) OVER (ORDER BY id ASC) AS nnd FROM values('id Int8, metric UInt8, ts {datatype}', (1,1,'2022-12-12 00:00:00'), (2,2,'2022-12-12 00:00:01'),(3,3,'2022-12-12 00:00:02'))" + ) + + +@TestScenario +def acceptance(self): + """Check function returns the expected result as defined by the original feature request.""" + data = """ + SELECT * FROM values('timestamp DateTime(3), metric_name String, metric_value UInt64', + ('2020-01-01 00:00:01.000','cpu',10), + ('2020-01-01 00:00:01.001','cpu',20), + ('2020-01-01 00:00:01.003','cpu',25), + ('2020-01-01 00:00:01.004','cpu',25), + ('2020-01-01 00:00:01.005','cpu',20), + ('2020-01-01 00:00:01.005','cpu',21), + ('2020-01-01 00:00:01.015','cpu',30), + ('2020-01-01 00:00:02.015','cpu',40), + ('2020-01-01 00:00:05.015','cpu',40), + ('2020-01-01 00:00:05.016','cpu',40), + ('2020-01-01 00:05:05.016','cpu',45) + )""".strip() + + with Check("workaround query"): + expected = convert_output( + """ + timestamp | metric_name | metric_value | rateNonNegative + -------------------------+-------------+--------------+---------------------- + 2020-01-01 00:00:01.000 | cpu | 10 | 6.337834459352404e-9 + 2020-01-01 00:00:01.001 | cpu | 20 | 10000 + 2020-01-01 00:00:01.003 | cpu | 25 | 2500 + 2020-01-01 00:00:01.004 | cpu | 25 | 0 + 2020-01-01 00:00:01.005 | cpu | 20 | 0 + 2020-01-01 00:00:01.005 | cpu | 21 | inf + 2020-01-01 00:00:01.015 | cpu | 30 | 900 + 2020-01-01 00:00:02.015 | cpu | 40 | 10 + 2020-01-01 00:00:05.015 | cpu | 40 | 0 + 2020-01-01 00:00:05.016 | cpu | 40 | 0 + 2020-01-01 00:05:05.016 | cpu | 45 | 0.016666666666666666 + """ + ) + + query = f""" + WITH + metric_value - prev_metric_value as delta_metric, + (toUnixTimestamp64Milli(timestamp) - toUnixTimestamp64Milli(prev_timestamp))/1000 as delta_ts + SELECT + timestamp, + metric_name, + metric_value, + if( delta_metric / delta_ts > 0, delta_metric / delta_ts, 0) as rateNonNegative + FROM + ( + SELECT + timestamp, + metric_name, + metric_value, + lagInFrame(metric_value) OVER (PARTITION BY metric_name ORDER BY timestamp ASC ROWS + BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS prev_metric_value, + lagInFrame(timestamp) OVER (PARTITION BY metric_name ORDER BY timestamp ASC ROWS + BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS prev_timestamp + FROM ( + {textwrap.indent(data, " "*8)} + ) t + )""" + + execute_query( + query, + expected=expected, + ) + + with Check("using nonNegativeDerivative"): + expected = convert_output( + """ + timestamp | metric_name | metric_value | rateNonNegative + -------------------------+-------------+--------------+---------------------- + 2020-01-01 00:00:01.000 | cpu | 10 | 0 + 2020-01-01 00:00:01.001 | cpu | 20 | 10000 + 2020-01-01 00:00:01.003 | cpu | 25 | 2500 + 2020-01-01 00:00:01.004 | cpu | 25 | 0 + 2020-01-01 00:00:01.005 | cpu | 20 | 0 + 2020-01-01 00:00:01.005 | cpu | 21 | 0 + 2020-01-01 00:00:01.015 | cpu | 30 | 900 + 2020-01-01 00:00:02.015 | cpu | 40 | 10 + 2020-01-01 00:00:05.015 | cpu | 40 | 0 + 2020-01-01 00:00:05.016 | cpu | 40 | 0 + 2020-01-01 00:05:05.016 | cpu | 45 | 0.016666666666666666 + """ + ) + + execute_query( + "SELECT timestamp, metric_name, metric_value, nonNegativeDerivative(" + "metric_value, timestamp, INTERVAL 1 SECOND) OVER " + "(PARTITION BY metric_name ORDER BY timestamp ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS rateNonNegative " + f"FROM ({data})", + expected=expected, + ) + + +@TestFeature +@Name("non-negative derivative func") +@Requirements( + RQ_SRS_019_ClickHouse_WindowFunctions_Specific_NonNegativeDerivative("1.0") +) +def feature(self): + """Check non-negative derivative window function.""" + for scenario in loads(current_module(), Scenario): + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/window_functions/tests/snapshots/common.py.tests.snapshot b/tests/testflows/window_functions/tests/snapshots/common.py.tests.snapshot index 68607f86d92..d9ddfe20a79 100644 --- a/tests/testflows/window_functions/tests/snapshots/common.py.tests.snapshot +++ b/tests/testflows/window_functions/tests/snapshots/common.py.tests.snapshot @@ -1,4 +1,4 @@ -func__count_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__count_salary__ = r""" func 10 9 @@ -12,7 +12,7 @@ func 1 """ -func__min_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__min_salary__ = r""" func 3500 3900 @@ -26,7 +26,7 @@ func 6000 """ -func__max_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__max_salary__ = r""" func 6000 6000 @@ -40,7 +40,7 @@ func 6000 """ -func__sum_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__sum_salary__ = r""" func 47100 43600 @@ -54,7 +54,7 @@ func 6000 """ -func__avg_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__avg_salary__ = r""" func 4710 4844.444444444444 @@ -68,7 +68,7 @@ func 6000 """ -func__any_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__any_salary__ = r""" func 3500 3900 @@ -82,7 +82,7 @@ func 6000 """ -func__stddevPop_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__stddevPop_salary__ = r""" func 683.3008122342604 581.3989089756045 @@ -96,7 +96,7 @@ func 0 """ -func__stddevSamp_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__stddevSamp_salary__ = r""" func 720.2622979011034 616.6666666666654 @@ -110,7 +110,7 @@ func nan """ -func__varPop_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__varPop_salary__ = r""" func 466900 338024.6913580232 @@ -124,7 +124,7 @@ func 0 """ -func__varSamp_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__varSamp_salary__ = r""" func 518777.77777777775 380277.7777777761 @@ -138,7 +138,7 @@ func nan """ -func__covarPop_salary__2000__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__covarPop_salary__2000__ = r""" func 0 0 @@ -152,7 +152,7 @@ func 0 """ -func__covarSamp_salary__2000__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__covarSamp_salary__2000__ = r""" func 0 0 @@ -166,7 +166,7 @@ func nan """ -func__anyHeavy_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__anyHeavy_salary__ = r""" func 5200 5200 @@ -180,7 +180,7 @@ func 6000 """ -func__anyLast_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__anyLast_salary__ = r""" func 6000 6000 @@ -194,7 +194,7 @@ func 6000 """ -func__argMin_salary__5000__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__argMin_salary__5000__ = r""" func 3500 3900 @@ -208,7 +208,7 @@ func 6000 """ -func__argMax_salary__5000__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__argMax_salary__5000__ = r""" func 3500 3900 @@ -222,7 +222,7 @@ func 6000 """ -func__avgWeighted_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__avgWeighted_salary__1__ = r""" func 4710 4844.444444444444 @@ -236,7 +236,7 @@ func 6000 """ -func__corr_salary__0_5__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__corr_salary__0_5__ = r""" func nan nan @@ -250,7 +250,7 @@ nan nan """ -func__topK_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__topK_salary__ = r""" func [4800,5200,3500,3900,4200,4500,5000,6000] [4800,5200,3900,4200,4500,5000,6000] @@ -264,7 +264,7 @@ func [6000] """ -func__topKWeighted_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__topKWeighted_salary__1__ = r""" func [4800,5200,3500,3900,4200,4500,5000,6000] [4800,5200,3900,4200,4500,5000,6000] @@ -278,7 +278,7 @@ func [6000] """ -func__groupArray_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupArray_salary__ = r""" func [3500,3900,4200,4500,4800,4800,5000,5200,5200,6000] [3900,4200,4500,4800,4800,5000,5200,5200,6000] @@ -292,7 +292,7 @@ func [6000] """ -func__groupUniqArray_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupUniqArray_salary__ = r""" func [3500,5000,6000,3900,4800,5200,4200,4500] [5000,6000,3900,4800,5200,4200,4500] @@ -306,7 +306,7 @@ func [6000] """ -func__groupArrayInsertAt_salary__0__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupArrayInsertAt_salary__0__ = r""" func [3500] [3900] @@ -320,7 +320,7 @@ func [6000] """ -func__groupArrayMovingSum_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupArrayMovingSum_salary__ = r""" func [3500,7400,11600,16100,20900,25700,30700,35900,41100,47100] [3900,8100,12600,17400,22200,27200,32400,37600,43600] @@ -334,7 +334,7 @@ func [6000] """ -func__groupArrayMovingAvg_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupArrayMovingAvg_salary__ = r""" func [350,740,1160,1610,2090,2570,3070,3590,4110,4710] [433.3333333333333,900,1400,1933.3333333333333,2466.6666666666665,3022.222222222222,3600,4177.777777777777,4844.444444444444] @@ -348,7 +348,7 @@ func [6000] """ -func__groupArraySample_3__1234__salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupArraySample_3__1234__salary__ = r""" func [6000,4800,4200] [4800,5000,4500] @@ -362,7 +362,7 @@ func [6000] """ -func__groupBitAnd_toUInt8_salary___ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupBitAnd_toUInt8_salary___ = r""" func 0 0 @@ -376,7 +376,7 @@ func 112 """ -func__groupBitOr_toUInt8_salary___ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupBitOr_toUInt8_salary___ = r""" func 252 252 @@ -390,7 +390,7 @@ func 112 """ -func__groupBitXor_toUInt8_salary___ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupBitXor_toUInt8_salary___ = r""" func 148 56 @@ -404,7 +404,7 @@ func 112 """ -func__groupBitmap_toUInt8_salary___ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__groupBitmap_toUInt8_salary___ = r""" func 8 7 @@ -418,7 +418,7 @@ func 1 """ -func__sumWithOverflow_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__sumWithOverflow_salary__ = r""" func 47100 43600 @@ -432,7 +432,7 @@ func 6000 """ -func__deltaSum_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__deltaSum_salary__ = r""" func 2500 2100 @@ -446,7 +446,7 @@ func 0 """ -func__sumMap__5000____salary___ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__sumMap__5000____salary___ = r""" func ([5000],[47100]) ([5000],[43600]) @@ -460,7 +460,7 @@ func ([5000],[6000]) """ -func__minMap__5000____salary___ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__minMap__5000____salary___ = r""" func ([5000],[3500]) ([5000],[3900]) @@ -474,7 +474,7 @@ func ([5000],[6000]) """ -func__maxMap__5000____salary___ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__maxMap__5000____salary___ = r""" func ([5000],[6000]) ([5000],[6000]) @@ -488,7 +488,7 @@ func ([5000],[6000]) """ -func__skewPop_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__skewPop_salary__ = r""" func -0.01162261667454972 0.2745338273905704 @@ -502,7 +502,7 @@ func nan """ -func__skewSamp_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__skewSamp_salary__ = r""" func -0.009923564086909852 0.2300737552746305 @@ -516,7 +516,7 @@ func nan """ -func__kurtPop_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__kurtPop_salary__ = r""" func 2.539217051205756 2.7206630060048402 @@ -530,7 +530,7 @@ func nan """ -func__kurtSamp_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__kurtSamp_salary__ = r""" func 2.0567658114766627 2.1496596590655526 @@ -544,7 +544,7 @@ func nan """ -func__uniq_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__uniq_salary__ = r""" func 8 7 @@ -558,7 +558,7 @@ func 1 """ -func__uniqExact_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__uniqExact_salary__ = r""" func 8 7 @@ -572,7 +572,7 @@ func 1 """ -func__uniqCombined_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__uniqCombined_salary__ = r""" func 8 7 @@ -586,7 +586,7 @@ func 1 """ -func__uniqCombined64_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__uniqCombined64_salary__ = r""" func 8 7 @@ -600,7 +600,7 @@ func 1 """ -func__uniqHLL12_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__uniqHLL12_salary__ = r""" func 8 7 @@ -614,7 +614,7 @@ func 1 """ -func__quantile_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantile_salary__ = r""" func 4800 4800 @@ -628,7 +628,7 @@ func 6000 """ -func__quantiles_0_5__salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantiles_0_5__salary__ = r""" func [4800] [4800] @@ -642,7 +642,7 @@ func [6000] """ -func__quantileExact_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantileExact_salary__ = r""" func 4800 4800 @@ -656,7 +656,7 @@ func 6000 """ -func__quantileExactWeighted_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantileExactWeighted_salary__1__ = r""" func 4800 4800 @@ -670,7 +670,7 @@ func 6000 """ -func__quantileTiming_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantileTiming_salary__ = r""" func 4800 4800 @@ -684,7 +684,7 @@ func 6000 """ -func__quantileTimingWeighted_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantileTimingWeighted_salary__1__ = r""" func 4800 4800 @@ -698,7 +698,7 @@ func 6000 """ -func__quantileDeterministic_salary__1234__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantileDeterministic_salary__1234__ = r""" func 4800 4800 @@ -712,7 +712,7 @@ func 6000 """ -func__quantileTDigest_salary__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantileTDigest_salary__ = r""" func 4800 4800 @@ -726,7 +726,7 @@ func 6000 """ -func__quantileTDigestWeighted_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__quantileTDigestWeighted_salary__1__ = r""" func 4800 4800 @@ -740,7 +740,7 @@ func 6000 """ -func__simpleLinearRegression_salary__empno__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__simpleLinearRegression_salary__empno__ = r""" func (0.0017991004497751124,-2.473763118440779) (0.0023192111029948868,-5.12417823228634) @@ -754,7 +754,7 @@ func (nan,nan) """ -func__stochasticLinearRegression_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__stochasticLinearRegression_salary__1__ = r""" func [0,0] [0,0] @@ -768,7 +768,7 @@ func [0,0] """ -func__stochasticLogisticRegression_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__stochasticLogisticRegression_salary__1__ = r""" func [0,0] [0,0] @@ -782,7 +782,5446 @@ func [0,0] """ -func__studentTTest_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__studentTTest_salary__1___version__22 = r""" +func +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +""" + +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__welchTTest_salary__1___version__22 = r""" +func +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +(nan,nan) +""" + +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__median_salary__ = r""" +func +4800 +4800 +4900 +5000 +5100 +5200 +5200 +5200 +5600 +6000 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_DateTime_time_column = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0.7310585786300049 +2 2020-01-01 00:00:02 1.5752103826044412 +3 2020-01-01 00:00:03 2.4926527345857696 +4 2020-01-01 00:00:04 3.4519415676621947 +5 2020-01-01 00:00:05 4.432932763071741 +6 2020-01-01 00:00:06 5.424412292903226 +7 2020-01-01 00:00:07 6.420707894737403 +8 2020-01-01 00:00:08 7.419134118454189 +9 2020-01-01 00:00:09 8.41847731304077 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_DateTime64_time_column = r""" +id time w +0 2020-01-01 00:00:00.000 0 +1 2020-01-01 00:00:01.000 0.7310585786300049 +2 2020-01-01 00:00:02.000 1.5752103826044412 +3 2020-01-01 00:00:03.000 2.4926527345857696 +4 2020-01-01 00:00:04.000 3.4519415676621947 +5 2020-01-01 00:00:05.000 4.432932763071741 +6 2020-01-01 00:00:06.000 5.424412292903226 +7 2020-01-01 00:00:07.000 6.420707894737403 +8 2020-01-01 00:00:08.000 7.419134118454189 +9 2020-01-01 00:00:09.000 8.41847731304077 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_DateTimeTZ_time_column = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0.7310585786300049 +2 2020-01-01 00:00:02 1.5752103826044412 +3 2020-01-01 00:00:03 2.4926527345857696 +4 2020-01-01 00:00:04 3.4519415676621947 +5 2020-01-01 00:00:05 4.432932763071741 +6 2020-01-01 00:00:06 5.424412292903226 +7 2020-01-01 00:00:07 6.420707894737403 +8 2020-01-01 00:00:08 7.419134118454189 +9 2020-01-01 00:00:09 8.41847731304077 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_DateTime64TZ_time_column = r""" +id time w +0 2020-01-01 00:00:00.000000000 0 +1 2020-01-01 00:00:01.000000000 0.7310585786300049 +2 2020-01-01 00:00:02.000000000 1.5752103826044412 +3 2020-01-01 00:00:03.000000000 2.4926527345857696 +4 2020-01-01 00:00:04.000000000 3.4519415676621947 +5 2020-01-01 00:00:05.000000000 4.432932763071741 +6 2020-01-01 00:00:06.000000000 5.424412292903226 +7 2020-01-01 00:00:07.000000000 6.420707894737403 +8 2020-01-01 00:00:08.000000000 7.419134118454189 +9 2020-01-01 00:00:09.000000000 8.41847731304077 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_decay_length_with_zero = r""" +id time w +0 2020-01-01 00:00:00 nan +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 nan +3 2020-01-01 00:00:03 nan +4 2020-01-01 00:00:04 nan +5 2020-01-01 00:00:05 nan +6 2020-01-01 00:00:06 nan +7 2020-01-01 00:00:07 nan +8 2020-01-01 00:00:08 nan +9 2020-01-01 00:00:09 nan +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_decay_length_with_negative = r""" +id time w +0 2020-01-01 00:00:00 999.0460634232365 +1 2020-01-01 00:00:01 999.0460634232365 +2 2020-01-01 00:00:02 999.0460634232365 +3 2020-01-01 00:00:03 999.0460634232365 +4 2020-01-01 00:00:04 999.0460634232365 +5 2020-01-01 00:00:05 999.0460634232365 +6 2020-01-01 00:00:06 999.0460634232365 +7 2020-01-01 00:00:07 999.0460634232365 +8 2020-01-01 00:00:08 999.0460634232365 +9 2020-01-01 00:00:09 999.0460634232365 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_0 = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 0 +3 2020-01-01 00:00:03 0 +4 2020-01-01 00:00:04 0 +5 2020-01-01 00:00:05 0 +6 2020-01-01 00:00:06 0 +7 2020-01-01 00:00:07 0 +8 2020-01-01 00:00:08 0 +9 2020-01-01 00:00:09 0 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_time_with_0 = r""" +id time w +0 2020-01-01 00:00:00 4999.5 +1 2020-01-01 00:00:01 4999.5 +2 2020-01-01 00:00:02 4999.5 +3 2020-01-01 00:00:03 4999.5 +4 2020-01-01 00:00:04 4999.5 +5 2020-01-01 00:00:05 4999.5 +6 2020-01-01 00:00:06 4999.5 +7 2020-01-01 00:00:07 4999.5 +8 2020-01-01 00:00:08 4999.5 +9 2020-01-01 00:00:09 4999.5 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_decay_length_overflow = r""" +id time w +0 2020-01-01 00:00:00 4999.5 +1 2020-01-01 00:00:01 4999.5 +2 2020-01-01 00:00:02 4999.5 +3 2020-01-01 00:00:03 4999.5 +4 2020-01-01 00:00:04 4999.5 +5 2020-01-01 00:00:05 4999.5 +6 2020-01-01 00:00:06 4999.5 +7 2020-01-01 00:00:07 4999.5 +8 2020-01-01 00:00:08 4999.5 +9 2020-01-01 00:00:09 4999.5 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Int8_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Int16_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Int32_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Int64_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_UInt8_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_UInt16_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_UInt32_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_UInt64_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Float32_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Float64_type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Decimal32_4__type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Decimal64_4__type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_input_value_with_Decimal128_4__type = r""" +id time exponentialTimeDecayedAvg(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 2.4428577575728454 +1 1970-01-01 03:00:02 2.4428577575728454 +2 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:03 2.4428577575728454 +3 1970-01-01 03:00:05 2.4428577575728454 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_toUInt32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0.52497918747894 +2 2020-01-01 00:00:02 1.0665557957551983 +3 2020-01-01 00:00:03 1.6246471821038961 +4 2020-01-01 00:00:04 2.199138467908942 +5 2020-01-01 00:00:05 2.7898833461901753 +6 2020-01-01 00:00:06 3.3967051006661944 +7 2020-01-01 00:00:07 4.019397822553705 +8 2020-01-01 00:00:08 4.657727808870022 +9 2020-01-01 00:00:09 5.311435123918215 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_toUInt64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0.52497918747894 +2 2020-01-01 00:00:02 1.0665557957551983 +3 2020-01-01 00:00:03 1.6246471821038961 +4 2020-01-01 00:00:04 2.199138467908942 +5 2020-01-01 00:00:05 2.7898833461901753 +6 2020-01-01 00:00:06 3.3967051006661944 +7 2020-01-01 00:00:07 4.019397822553705 +8 2020-01-01 00:00:08 4.657727808870022 +9 2020-01-01 00:00:09 5.311435123918215 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_toFloat32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0.5237915435013812 +2 2020-01-01 00:00:02 1.0633962697787114 +3 2020-01-01 00:00:03 1.6187427337534772 +4 2020-01-01 00:00:04 2.1897315566228315 +5 2020-01-01 00:00:05 2.77623606042911 +6 2020-01-01 00:00:06 3.378103070246944 +7 2020-01-01 00:00:07 3.995153874104678 +8 2020-01-01 00:00:08 4.627185328971674 +9 2020-01-01 00:00:09 5.273971099585486 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_toFloat64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0.5237915435013812 +2 2020-01-01 00:00:02 1.0633962697787114 +3 2020-01-01 00:00:03 1.6187427337534772 +4 2020-01-01 00:00:04 2.1897315566228315 +5 2020-01-01 00:00:05 2.77623606042911 +6 2020-01-01 00:00:06 3.378103070246944 +7 2020-01-01 00:00:07 3.995153874104678 +8 2020-01-01 00:00:08 4.627185328971674 +9 2020-01-01 00:00:09 5.273971099585486 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_one_row_partitions = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check__1_time_gap = r""" +id time exponentialTimeDecayedAvg(1)(id, time) OVER () +1 2022-01-01 00:00:00 3.255762093989612 +2 2022-01-01 00:00:00 3.255762093989612 +3 2022-01-01 00:00:00 3.255762093989612 +4 2022-01-01 00:00:01 3.255762093989612 +5 2022-01-01 00:00:00 3.255762093989612 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_0_time_gap = r""" +id time exponentialTimeDecayedAvg(1)(id, time) OVER () +1 2022-01-01 00:00:00 -1.8 +2 2022-01-01 00:00:00 -1.8 +-3 2022-01-01 00:00:00 -1.8 +-4 2022-01-01 00:00:00 -1.8 +-5 2022-01-01 00:00:00 -1.8 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.68302837130835 +3 2020-01-01 00:00:03 48.699517020495165 +4 2020-01-01 00:00:04 48.71736284737082 +5 2020-01-01 00:00:05 48.736669997228184 +6 2020-01-01 00:00:06 48.75754970551674 +7 2020-01-01 00:00:07 48.78012067255031 +8 2020-01-01 00:00:08 48.80450944473328 +9 2020-01-01 00:00:09 48.830850800540155 +10 2020-01-01 00:00:10 48.85928813919405 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13495758327850693138 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 799083818724233891 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 3.099667994624956 +4 2020-01-01 00:00:04 4.52497918747894 +5 2020-01-01 00:00:05 6.099667994624955 +7 2020-01-01 00:00:07 7.52497918747894 +8 2020-01-01 00:00:08 9.099667994624957 +10 2020-01-01 00:00:10 10.524979187478941 +11 2020-01-01 00:00:11 12.099667994624955 +13 2020-01-01 00:00:13 13.52497918747894 +14 2020-01-01 00:00:14 15.099667994624953 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 2.52497918747894 +3 2020-01-01 00:00:03 3.52497918747894 +4 2020-01-01 00:00:04 4.52497918747894 +5 2020-01-01 00:00:05 5.524979187478941 +6 2020-01-01 00:00:06 6.52497918747894 +7 2020-01-01 00:00:07 7.52497918747894 +8 2020-01-01 00:00:08 8.524979187478941 +9 2020-01-01 00:00:09 9.524979187478941 +10 2020-01-01 00:00:10 10.524979187478941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6998628102243875284 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5437358706373763486 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +4 2020-01-01 00:00:04 2.4919545561453664 +5 2020-01-01 00:00:05 3.248306737913917 +7 2020-01-01 00:00:07 4.25821335155325 +8 2020-01-01 00:00:08 5.116151200593762 +10 2020-01-01 00:00:10 6.184642405239253 +11 2020-01-01 00:00:11 7.12224457526869 +13 2020-01-01 00:00:13 8.251527756309828 +14 2020-01-01 00:00:14 9.258345198781718 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +3 2020-01-01 00:00:03 2.0665557957551988 +4 2020-01-01 00:00:04 2.624647182103896 +5 2020-01-01 00:00:05 3.199138467908942 +6 2020-01-01 00:00:06 3.7898833461901758 +7 2020-01-01 00:00:07 4.396705100666194 +8 2020-01-01 00:00:08 5.019397822553704 +9 2020-01-01 00:00:09 5.657727808870021 +10 2020-01-01 00:00:10 6.311435123918215 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16624019062377156056 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6829062704342881462 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 1.5249791874789398 +5 2020-01-01 00:00:05 2.4919545561453664 +7 2020-01-01 00:00:07 3.248306737913917 +8 2020-01-01 00:00:08 4.25821335155325 +10 2020-01-01 00:00:10 5.116151200593762 +11 2020-01-01 00:00:11 6.184642405239253 +13 2020-01-01 00:00:13 7.12224457526869 +14 2020-01-01 00:00:14 8.251527756309828 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1.5249791874789398 +4 2020-01-01 00:00:04 2.0665557957551988 +5 2020-01-01 00:00:05 2.624647182103896 +6 2020-01-01 00:00:06 3.199138467908942 +7 2020-01-01 00:00:07 3.7898833461901758 +8 2020-01-01 00:00:08 4.396705100666194 +9 2020-01-01 00:00:09 5.019397822553704 +10 2020-01-01 00:00:10 5.657727808870021 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 2840650869004265920 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 12349134980424805700 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.66779947798152 +4 2020-01-01 00:00:04 48.66779947798152 +5 2020-01-01 00:00:05 48.66779947798152 +6 2020-01-01 00:00:06 48.66779947798152 +7 2020-01-01 00:00:07 48.66779947798152 +8 2020-01-01 00:00:08 48.66779947798152 +9 2020-01-01 00:00:09 48.66779947798152 +10 2020-01-01 00:00:10 48.66779947798152 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15562077973505474208 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16458442593046828105 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +4 2020-01-01 00:00:04 3.099667994624956 +5 2020-01-01 00:00:05 4.52497918747894 +7 2020-01-01 00:00:07 6.099667994624955 +8 2020-01-01 00:00:08 7.52497918747894 +10 2020-01-01 00:00:10 9.099667994624957 +11 2020-01-01 00:00:11 10.524979187478941 +13 2020-01-01 00:00:13 12.099667994624955 +14 2020-01-01 00:00:14 13.52497918747894 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +3 2020-01-01 00:00:03 2.52497918747894 +4 2020-01-01 00:00:04 3.52497918747894 +5 2020-01-01 00:00:05 4.52497918747894 +6 2020-01-01 00:00:06 5.524979187478941 +7 2020-01-01 00:00:07 6.52497918747894 +8 2020-01-01 00:00:08 7.52497918747894 +9 2020-01-01 00:00:09 8.524979187478941 +10 2020-01-01 00:00:10 9.524979187478941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7297242392081283338 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7553695442776722505 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.68302837130835 +4 2020-01-01 00:00:04 48.699517020495165 +5 2020-01-01 00:00:05 48.71736284737082 +6 2020-01-01 00:00:06 48.736669997228184 +7 2020-01-01 00:00:07 48.75754970551674 +8 2020-01-01 00:00:08 48.78012067255031 +9 2020-01-01 00:00:09 48.80450944473328 +10 2020-01-01 00:00:10 48.830850800540155 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 9881448387590534551 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4076788104734413191 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 2.4919545561453664 +4 2020-01-01 00:00:04 3.8179519532644535 +5 2020-01-01 00:00:05 5.491954556145366 +7 2020-01-01 00:00:07 6.817951953264453 +8 2020-01-01 00:00:08 8.491954556145366 +10 2020-01-01 00:00:10 9.817951953264453 +11 2020-01-01 00:00:11 11.491954556145366 +13 2020-01-01 00:00:13 12.817951953264451 +14 2020-01-01 00:00:14 14.491954556145364 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 2.0665557957551988 +3 2020-01-01 00:00:03 3.0665557957551988 +4 2020-01-01 00:00:04 4.066555795755199 +5 2020-01-01 00:00:05 5.066555795755199 +6 2020-01-01 00:00:06 6.066555795755198 +7 2020-01-01 00:00:07 7.066555795755197 +8 2020-01-01 00:00:08 8.066555795755196 +9 2020-01-01 00:00:09 9.066555795755198 +10 2020-01-01 00:00:10 10.066555795755198 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 14429555309796454170 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15059704790173788829 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.68302837130835 +2 2020-01-01 00:00:02 48.699517020495165 +3 2020-01-01 00:00:03 48.71736284737082 +4 2020-01-01 00:00:04 48.736669997228184 +5 2020-01-01 00:00:05 48.75754970551674 +6 2020-01-01 00:00:06 48.78012067255031 +7 2020-01-01 00:00:07 48.80450944473328 +8 2020-01-01 00:00:08 48.830850800540155 +9 2020-01-01 00:00:09 48.85928813919405 +10 2020-01-01 00:00:10 48.88997386967902 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13239221788919936536 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16402863909584675538 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.66779947798152 +4 2020-01-01 00:00:04 48.66779947798152 +5 2020-01-01 00:00:05 48.66779947798152 +6 2020-01-01 00:00:06 48.66779947798152 +7 2020-01-01 00:00:07 48.66779947798152 +8 2020-01-01 00:00:08 48.66779947798152 +9 2020-01-01 00:00:09 48.66779947798152 +10 2020-01-01 00:00:10 48.66779947798152 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15562077973505474208 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16458442593046828105 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.66779947798152 +4 2020-01-01 00:00:04 48.66779947798152 +5 2020-01-01 00:00:05 48.66779947798152 +6 2020-01-01 00:00:06 48.66779947798152 +7 2020-01-01 00:00:07 48.66779947798152 +8 2020-01-01 00:00:08 48.66779947798152 +9 2020-01-01 00:00:09 48.66779947798152 +10 2020-01-01 00:00:10 48.66779947798152 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15562077973505474208 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16458442593046828105 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.66779947798152 +4 2020-01-01 00:00:04 48.66779947798152 +5 2020-01-01 00:00:05 48.66779947798152 +6 2020-01-01 00:00:06 48.66779947798152 +7 2020-01-01 00:00:07 48.66779947798152 +8 2020-01-01 00:00:08 48.66779947798152 +9 2020-01-01 00:00:09 48.66779947798152 +10 2020-01-01 00:00:10 48.66779947798152 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15562077973505474208 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16458442593046828105 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.66779947798152 +4 2020-01-01 00:00:04 48.66779947798152 +5 2020-01-01 00:00:05 48.66779947798152 +6 2020-01-01 00:00:06 48.66779947798152 +7 2020-01-01 00:00:07 48.66779947798152 +8 2020-01-01 00:00:08 48.66779947798152 +9 2020-01-01 00:00:09 48.66779947798152 +10 2020-01-01 00:00:10 48.66779947798152 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15562077973505474208 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16458442593046828105 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.68302837130835 +3 2020-01-01 00:00:03 48.699517020495165 +4 2020-01-01 00:00:04 48.71736284737082 +5 2020-01-01 00:00:05 48.736669997228184 +6 2020-01-01 00:00:06 48.75754970551674 +7 2020-01-01 00:00:07 48.78012067255031 +8 2020-01-01 00:00:08 48.80450944473328 +9 2020-01-01 00:00:09 48.830850800540155 +10 2020-01-01 00:00:10 48.85928813919405 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13495758327850693138 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 799083818724233891 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 1.9999999999999998 +4 2020-01-01 00:00:04 4.524979187478939 +5 2020-01-01 00:00:05 4.999999999999999 +7 2020-01-01 00:00:07 7.524979187478941 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10.52497918747894 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13.524979187478941 +14 2020-01-01 00:00:14 14.000000000000002 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 2.52497918747894 +3 2020-01-01 00:00:03 3.52497918747894 +4 2020-01-01 00:00:04 4.52497918747894 +5 2020-01-01 00:00:05 5.524979187478941 +6 2020-01-01 00:00:06 6.52497918747894 +7 2020-01-01 00:00:07 7.52497918747894 +8 2020-01-01 00:00:08 8.524979187478941 +9 2020-01-01 00:00:09 9.524979187478941 +10 2020-01-01 00:00:10 10.524979187478941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6998628102243875284 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 9329909658882923324 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +4 2020-01-01 00:00:04 2.4919545561453664 +5 2020-01-01 00:00:05 3.248306737913917 +7 2020-01-01 00:00:07 4.25821335155325 +8 2020-01-01 00:00:08 5.116151200593762 +10 2020-01-01 00:00:10 6.184642405239253 +11 2020-01-01 00:00:11 7.12224457526869 +13 2020-01-01 00:00:13 8.251527756309828 +14 2020-01-01 00:00:14 9.258345198781718 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +3 2020-01-01 00:00:03 2.0665557957551988 +4 2020-01-01 00:00:04 2.624647182103896 +5 2020-01-01 00:00:05 3.199138467908942 +6 2020-01-01 00:00:06 3.7898833461901758 +7 2020-01-01 00:00:07 4.396705100666194 +8 2020-01-01 00:00:08 5.019397822553704 +9 2020-01-01 00:00:09 5.657727808870021 +10 2020-01-01 00:00:10 6.311435123918215 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16624019062377156056 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6829062704342881462 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 1.5249791874789398 +5 2020-01-01 00:00:05 2.4919545561453664 +7 2020-01-01 00:00:07 3.248306737913917 +8 2020-01-01 00:00:08 4.25821335155325 +10 2020-01-01 00:00:10 5.116151200593762 +11 2020-01-01 00:00:11 6.184642405239253 +13 2020-01-01 00:00:13 7.12224457526869 +14 2020-01-01 00:00:14 8.251527756309828 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1.5249791874789398 +4 2020-01-01 00:00:04 2.0665557957551988 +5 2020-01-01 00:00:05 2.624647182103896 +6 2020-01-01 00:00:06 3.199138467908942 +7 2020-01-01 00:00:07 3.7898833461901758 +8 2020-01-01 00:00:08 4.396705100666194 +9 2020-01-01 00:00:09 5.019397822553704 +10 2020-01-01 00:00:10 5.657727808870021 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 2840650869004265920 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 12349134980424805700 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.66779947798152 +4 2020-01-01 00:00:04 48.66779947798152 +5 2020-01-01 00:00:05 48.66779947798152 +6 2020-01-01 00:00:06 48.66779947798152 +7 2020-01-01 00:00:07 48.66779947798152 +8 2020-01-01 00:00:08 48.66779947798152 +9 2020-01-01 00:00:09 48.66779947798152 +10 2020-01-01 00:00:10 48.66779947798152 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15562077973505474208 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16458442593046828105 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 4.524979187478939 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 7.524979187478941 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 10.52497918747894 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 13.524979187478941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.5249791874789398 +3 2020-01-01 00:00:03 2.52497918747894 +4 2020-01-01 00:00:04 3.52497918747894 +5 2020-01-01 00:00:05 4.52497918747894 +6 2020-01-01 00:00:06 5.524979187478941 +7 2020-01-01 00:00:07 6.52497918747894 +8 2020-01-01 00:00:08 7.52497918747894 +9 2020-01-01 00:00:09 8.524979187478941 +10 2020-01-01 00:00:10 9.524979187478941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7297242392081283338 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 18027367577351402446 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.66779947798152 +2 2020-01-01 00:00:02 48.66779947798152 +3 2020-01-01 00:00:03 48.68302837130835 +4 2020-01-01 00:00:04 48.699517020495165 +5 2020-01-01 00:00:05 48.71736284737082 +6 2020-01-01 00:00:06 48.736669997228184 +7 2020-01-01 00:00:07 48.75754970551674 +8 2020-01-01 00:00:08 48.78012067255031 +9 2020-01-01 00:00:09 48.80450944473328 +10 2020-01-01 00:00:10 48.830850800540155 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 9881448387590534551 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4541465367653127624 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 1.5249791874789398 +4 2020-01-01 00:00:04 4.524979187478939 +5 2020-01-01 00:00:05 4.524979187478939 +7 2020-01-01 00:00:07 7.524979187478941 +8 2020-01-01 00:00:08 7.524979187478941 +10 2020-01-01 00:00:10 10.52497918747894 +11 2020-01-01 00:00:11 10.52497918747894 +13 2020-01-01 00:00:13 13.524979187478941 +14 2020-01-01 00:00:14 13.524979187478941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.5249791874789398 +2 2020-01-01 00:00:02 2.0665557957551988 +3 2020-01-01 00:00:03 3.0665557957551988 +4 2020-01-01 00:00:04 4.066555795755199 +5 2020-01-01 00:00:05 5.066555795755199 +6 2020-01-01 00:00:06 6.066555795755198 +7 2020-01-01 00:00:07 7.066555795755197 +8 2020-01-01 00:00:08 8.066555795755196 +9 2020-01-01 00:00:09 9.066555795755198 +10 2020-01-01 00:00:10 10.066555795755198 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 14429555309796454170 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15307615954504467838 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9988.95009144695 +2 2020-01-01 00:00:02 9988.95009144695 +4 2020-01-01 00:00:04 9988.95009144695 +5 2020-01-01 00:00:05 9988.95009144695 +7 2020-01-01 00:00:07 9988.95009144695 +8 2020-01-01 00:00:08 9988.95009144695 +10 2020-01-01 00:00:10 9988.95009144695 +11 2020-01-01 00:00:11 9988.95009144695 +13 2020-01-01 00:00:13 9988.95009144695 +14 2020-01-01 00:00:14 9988.95009144695 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 48.68302837130835 +2 2020-01-01 00:00:02 48.699517020495165 +3 2020-01-01 00:00:03 48.71736284737082 +4 2020-01-01 00:00:04 48.736669997228184 +5 2020-01-01 00:00:05 48.75754970551674 +6 2020-01-01 00:00:06 48.78012067255031 +7 2020-01-01 00:00:07 48.80450944473328 +8 2020-01-01 00:00:08 48.830850800540155 +9 2020-01-01 00:00:09 48.85928813919405 +10 2020-01-01 00:00:10 48.88997386967902 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13239221788919936536 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedAvg_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16402863909584675538 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_DateTime_time_column = r""" +id time w +0 2020-01-01 00:00:00 1 +1 2020-01-01 00:00:01 1.3678794411714423 +2 2020-01-01 00:00:02 1.5032147244080551 +3 2020-01-01 00:00:03 1.553001792775919 +4 2020-01-01 00:00:04 1.5713174316646532 +5 2020-01-01 00:00:05 1.5780553786637386 +6 2020-01-01 00:00:06 1.5805341308404048 +7 2020-01-01 00:00:07 1.5814460128059595 +8 2020-01-01 00:00:08 1.581781475433862 +9 2020-01-01 00:00:09 1.5819048852379487 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_DateTime64_time_column = r""" +id time w +0 2020-01-01 00:00:00.000 1 +1 2020-01-01 00:00:01.000 1.3678794411714423 +2 2020-01-01 00:00:02.000 1.5032147244080551 +3 2020-01-01 00:00:03.000 1.553001792775919 +4 2020-01-01 00:00:04.000 1.5713174316646532 +5 2020-01-01 00:00:05.000 1.5780553786637386 +6 2020-01-01 00:00:06.000 1.5805341308404048 +7 2020-01-01 00:00:07.000 1.5814460128059595 +8 2020-01-01 00:00:08.000 1.581781475433862 +9 2020-01-01 00:00:09.000 1.5819048852379487 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_DateTimeTZ_time_column = r""" +id time w +0 2020-01-01 00:00:00 1 +1 2020-01-01 00:00:01 1.3678794411714423 +2 2020-01-01 00:00:02 1.5032147244080551 +3 2020-01-01 00:00:03 1.553001792775919 +4 2020-01-01 00:00:04 1.5713174316646532 +5 2020-01-01 00:00:05 1.5780553786637386 +6 2020-01-01 00:00:06 1.5805341308404048 +7 2020-01-01 00:00:07 1.5814460128059595 +8 2020-01-01 00:00:08 1.581781475433862 +9 2020-01-01 00:00:09 1.5819048852379487 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_DateTime64TZ_time_column = r""" +id time w +0 2020-01-01 00:00:00.000000000 1 +1 2020-01-01 00:00:01.000000000 1.3678794411714423 +2 2020-01-01 00:00:02.000000000 1.5032147244080551 +3 2020-01-01 00:00:03.000000000 1.553001792775919 +4 2020-01-01 00:00:04.000000000 1.5713174316646532 +5 2020-01-01 00:00:05.000000000 1.5780553786637386 +6 2020-01-01 00:00:06.000000000 1.5805341308404048 +7 2020-01-01 00:00:07.000000000 1.5814460128059595 +8 2020-01-01 00:00:08.000000000 1.581781475433862 +9 2020-01-01 00:00:09.000000000 1.5819048852379487 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_decay_length_with_zero = r""" +id time w +0 2020-01-01 00:00:00 nan +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 nan +3 2020-01-01 00:00:03 nan +4 2020-01-01 00:00:04 nan +5 2020-01-01 00:00:05 nan +6 2020-01-01 00:00:06 nan +7 2020-01-01 00:00:07 nan +8 2020-01-01 00:00:08 nan +9 2020-01-01 00:00:09 nan +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_decay_length_with_negative = r""" +id time w +0 2020-01-01 00:00:00 22014454.897364672 +1 2020-01-01 00:00:01 22014454.897364672 +2 2020-01-01 00:00:02 22014454.897364672 +3 2020-01-01 00:00:03 22014454.897364672 +4 2020-01-01 00:00:04 22014454.897364672 +5 2020-01-01 00:00:05 22014454.897364672 +6 2020-01-01 00:00:06 22014454.897364672 +7 2020-01-01 00:00:07 22014454.897364672 +8 2020-01-01 00:00:08 22014454.897364672 +9 2020-01-01 00:00:09 22014454.897364672 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_decay_length_overflow = r""" +id time w +0 2020-01-01 00:00:00 10000 +1 2020-01-01 00:00:01 10000 +2 2020-01-01 00:00:02 10000 +3 2020-01-01 00:00:03 10000 +4 2020-01-01 00:00:04 10000 +5 2020-01-01 00:00:05 10000 +6 2020-01-01 00:00:06 10000 +7 2020-01-01 00:00:07 10000 +8 2020-01-01 00:00:08 10000 +9 2020-01-01 00:00:09 10000 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_input_time_with_0 = r""" +id time w +0 2020-01-01 00:00:00 10000 +1 2020-01-01 00:00:01 10000 +2 2020-01-01 00:00:02 10000 +3 2020-01-01 00:00:03 10000 +4 2020-01-01 00:00:04 10000 +5 2020-01-01 00:00:05 10000 +6 2020-01-01 00:00:06 10000 +7 2020-01-01 00:00:07 10000 +8 2020-01-01 00:00:08 10000 +9 2020-01-01 00:00:09 10000 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_toUInt32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 1 +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 2.723568171113941 +3 2020-01-01 00:00:03 3.4643863917956588 +4 2020-01-01 00:00:04 4.134706437831298 +5 2020-01-01 00:00:05 4.741237097543931 +6 2020-01-01 00:00:06 5.290048733637957 +7 2020-01-01 00:00:07 5.7866340374293666 +8 2020-01-01 00:00:08 6.235963001546588 +9 2020-01-01 00:00:09 6.642532661287187 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_toUInt64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 1 +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 2.723568171113941 +3 2020-01-01 00:00:03 3.4643863917956588 +4 2020-01-01 00:00:04 4.134706437831298 +5 2020-01-01 00:00:05 4.741237097543931 +6 2020-01-01 00:00:06 5.290048733637957 +7 2020-01-01 00:00:07 5.7866340374293666 +8 2020-01-01 00:00:08 6.235963001546588 +9 2020-01-01 00:00:09 6.642532661287187 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_toFloat32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 1 +1 2020-01-01 00:00:01 1.909156442876713 +2 2020-01-01 00:00:02 2.735721880500951 +3 2020-01-01 00:00:03 3.487199173576237 +4 2020-01-01 00:00:04 4.170409596251185 +5 2020-01-01 00:00:05 4.791554753866636 +6 2020-01-01 00:00:06 5.356272875874395 +7 2020-01-01 00:00:07 5.869689994906987 +8 2020-01-01 00:00:08 6.336466476558669 +9 2020-01-01 00:00:09 6.7608393222356185 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_toFloat64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 1 +1 2020-01-01 00:00:01 1.909156442876713 +2 2020-01-01 00:00:02 2.735721880500951 +3 2020-01-01 00:00:03 3.487199173576237 +4 2020-01-01 00:00:04 4.170409596251185 +5 2020-01-01 00:00:05 4.791554753866636 +6 2020-01-01 00:00:06 5.356272875874395 +7 2020-01-01 00:00:07 5.869689994906987 +8 2020-01-01 00:00:08 6.336466476558669 +9 2020-01-01 00:00:09 6.7608393222356185 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_one_row_partitions = r""" +id time w +0 2020-01-01 00:00:00 1 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check__1_time_gap = r""" +id time exponentialTimeDecayedCount(1)(time) OVER () +1 2022-01-01 00:00:00 6.718281828459045 +2 2022-01-01 00:00:00 6.718281828459045 +3 2022-01-01 00:00:00 6.718281828459045 +4 2022-01-01 00:00:01 6.718281828459045 +5 2022-01-01 00:00:00 6.718281828459045 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_0_time_gap = r""" +id time exponentialTimeDecayedCount(1)(time) OVER () +1 2022-01-01 00:00:00 5 +2 2022-01-01 00:00:00 5 +-3 2022-01-01 00:00:00 5 +-4 2022-01-01 00:00:00 5 +-5 2022-01-01 00:00:00 5 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +10 2020-01-01 00:00:10 1 +11 2020-01-01 00:00:11 1 +13 2020-01-01 00:00:13 1 +14 2020-01-01 00:00:14 1 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +10 2020-01-01 00:00:10 1 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 12877234599328637328 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 3447050494505378762 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.473171429072192 +3 2020-01-01 00:00:03 10.46947356535571 +4 2020-01-01 00:00:04 10.465386793917245 +5 2020-01-01 00:00:05 10.460870212974633 +6 2020-01-01 00:00:06 10.455878619067724 +7 2020-01-01 00:00:07 10.450362054646963 +8 2020-01-01 00:00:08 10.444265308081446 +9 2020-01-01 00:00:09 10.437527361082362 +10 2020-01-01 00:00:10 10.430080778011437 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4560842635161322144 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 17878131935679005193 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 1.8187307530779817 +4 2020-01-01 00:00:04 1.9048374180359593 +5 2020-01-01 00:00:05 1.8187307530779817 +7 2020-01-01 00:00:07 1.9048374180359593 +8 2020-01-01 00:00:08 1.8187307530779817 +10 2020-01-01 00:00:10 1.9048374180359593 +11 2020-01-01 00:00:11 1.8187307530779817 +13 2020-01-01 00:00:13 1.9048374180359593 +14 2020-01-01 00:00:14 1.8187307530779817 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 1.9048374180359593 +3 2020-01-01 00:00:03 1.9048374180359593 +4 2020-01-01 00:00:04 1.9048374180359593 +5 2020-01-01 00:00:05 1.9048374180359593 +6 2020-01-01 00:00:06 1.9048374180359593 +7 2020-01-01 00:00:07 1.9048374180359593 +8 2020-01-01 00:00:08 1.9048374180359593 +9 2020-01-01 00:00:09 1.9048374180359593 +10 2020-01-01 00:00:10 1.9048374180359593 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8495990306826262494 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 10218776842808504744 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +4 2020-01-01 00:00:04 2.5595489737597 +5 2020-01-01 00:00:05 3.3159756847533166 +7 2020-01-01 00:00:07 3.714891269566359 +8 2020-01-01 00:00:08 4.3613726246387525 +10 2020-01-01 00:00:10 4.57078989342418 +11 2020-01-01 00:00:11 5.135821725550794 +13 2020-01-01 00:00:13 5.204855189034461 +14 2020-01-01 00:00:14 5.7095477304970075 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +3 2020-01-01 00:00:03 2.723568171113941 +4 2020-01-01 00:00:04 3.4643863917956588 +5 2020-01-01 00:00:05 4.134706437831298 +6 2020-01-01 00:00:06 4.741237097543931 +7 2020-01-01 00:00:07 5.290048733637957 +8 2020-01-01 00:00:08 5.7866340374293666 +9 2020-01-01 00:00:09 6.235963001546588 +10 2020-01-01 00:00:10 6.642532661287187 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16737121499884598835 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 11839951592374520142 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 1.9048374180359595 +5 2020-01-01 00:00:05 2.5595489737597 +7 2020-01-01 00:00:07 3.3159756847533166 +8 2020-01-01 00:00:08 3.714891269566359 +10 2020-01-01 00:00:10 4.3613726246387525 +11 2020-01-01 00:00:11 4.57078989342418 +13 2020-01-01 00:00:13 5.135821725550794 +14 2020-01-01 00:00:14 5.204855189034461 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1.9048374180359595 +4 2020-01-01 00:00:04 2.723568171113941 +5 2020-01-01 00:00:05 3.4643863917956588 +6 2020-01-01 00:00:06 4.134706437831298 +7 2020-01-01 00:00:07 4.741237097543931 +8 2020-01-01 00:00:08 5.290048733637957 +9 2020-01-01 00:00:09 5.7866340374293666 +10 2020-01-01 00:00:10 6.235963001546588 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6034479436322793231 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 11997635277937493853 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.476517394529663 +4 2020-01-01 00:00:04 10.476517394529663 +5 2020-01-01 00:00:05 10.476517394529663 +6 2020-01-01 00:00:06 10.476517394529663 +7 2020-01-01 00:00:07 10.476517394529663 +8 2020-01-01 00:00:08 10.476517394529663 +9 2020-01-01 00:00:09 10.476517394529663 +10 2020-01-01 00:00:10 10.476517394529663 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13152195228564121686 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5718761771932584523 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +4 2020-01-01 00:00:04 1.8187307530779817 +5 2020-01-01 00:00:05 1.9048374180359593 +7 2020-01-01 00:00:07 1.8187307530779817 +8 2020-01-01 00:00:08 1.9048374180359593 +10 2020-01-01 00:00:10 1.8187307530779817 +11 2020-01-01 00:00:11 1.9048374180359593 +13 2020-01-01 00:00:13 1.8187307530779817 +14 2020-01-01 00:00:14 1.9048374180359593 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +3 2020-01-01 00:00:03 1.9048374180359593 +4 2020-01-01 00:00:04 1.9048374180359593 +5 2020-01-01 00:00:05 1.9048374180359593 +6 2020-01-01 00:00:06 1.9048374180359593 +7 2020-01-01 00:00:07 1.9048374180359593 +8 2020-01-01 00:00:08 1.9048374180359593 +9 2020-01-01 00:00:09 1.9048374180359593 +10 2020-01-01 00:00:10 1.9048374180359593 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16247217040454175541 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13039042947170329667 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.473171429072192 +4 2020-01-01 00:00:04 10.46947356535571 +5 2020-01-01 00:00:05 10.465386793917245 +6 2020-01-01 00:00:06 10.460870212974633 +7 2020-01-01 00:00:07 10.455878619067724 +8 2020-01-01 00:00:08 10.450362054646963 +9 2020-01-01 00:00:09 10.444265308081446 +10 2020-01-01 00:00:10 10.437527361082362 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16306225357017751068 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 14734888548198881343 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 2.5595489737597 +4 2020-01-01 00:00:04 2.6456556387176775 +5 2020-01-01 00:00:05 2.5595489737597 +7 2020-01-01 00:00:07 2.6456556387176775 +8 2020-01-01 00:00:08 2.5595489737597 +10 2020-01-01 00:00:10 2.6456556387176775 +11 2020-01-01 00:00:11 2.5595489737597 +13 2020-01-01 00:00:13 2.6456556387176775 +14 2020-01-01 00:00:14 2.5595489737597 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 2.723568171113941 +3 2020-01-01 00:00:03 2.723568171113941 +4 2020-01-01 00:00:04 2.723568171113941 +5 2020-01-01 00:00:05 2.723568171113941 +6 2020-01-01 00:00:06 2.723568171113941 +7 2020-01-01 00:00:07 2.723568171113941 +8 2020-01-01 00:00:08 2.723568171113941 +9 2020-01-01 00:00:09 2.723568171113941 +10 2020-01-01 00:00:10 2.723568171113941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 12761081601402852228 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 10794675264479804918 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.473171429072192 +2 2020-01-01 00:00:02 10.46947356535571 +3 2020-01-01 00:00:03 10.465386793917245 +4 2020-01-01 00:00:04 10.460870212974633 +5 2020-01-01 00:00:05 10.455878619067724 +6 2020-01-01 00:00:06 10.450362054646963 +7 2020-01-01 00:00:07 10.444265308081446 +8 2020-01-01 00:00:08 10.437527361082362 +9 2020-01-01 00:00:09 10.430080778011437 +10 2020-01-01 00:00:10 10.421851030962417 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 3475391510808484800 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6845134164707796627 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.476517394529663 +4 2020-01-01 00:00:04 10.476517394529663 +5 2020-01-01 00:00:05 10.476517394529663 +6 2020-01-01 00:00:06 10.476517394529663 +7 2020-01-01 00:00:07 10.476517394529663 +8 2020-01-01 00:00:08 10.476517394529663 +9 2020-01-01 00:00:09 10.476517394529663 +10 2020-01-01 00:00:10 10.476517394529663 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13152195228564121686 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5718761771932584523 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.476517394529663 +4 2020-01-01 00:00:04 10.476517394529663 +5 2020-01-01 00:00:05 10.476517394529663 +6 2020-01-01 00:00:06 10.476517394529663 +7 2020-01-01 00:00:07 10.476517394529663 +8 2020-01-01 00:00:08 10.476517394529663 +9 2020-01-01 00:00:09 10.476517394529663 +10 2020-01-01 00:00:10 10.476517394529663 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13152195228564121686 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5718761771932584523 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.476517394529663 +4 2020-01-01 00:00:04 10.476517394529663 +5 2020-01-01 00:00:05 10.476517394529663 +6 2020-01-01 00:00:06 10.476517394529663 +7 2020-01-01 00:00:07 10.476517394529663 +8 2020-01-01 00:00:08 10.476517394529663 +9 2020-01-01 00:00:09 10.476517394529663 +10 2020-01-01 00:00:10 10.476517394529663 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13152195228564121686 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5718761771932584523 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.476517394529663 +4 2020-01-01 00:00:04 10.476517394529663 +5 2020-01-01 00:00:05 10.476517394529663 +6 2020-01-01 00:00:06 10.476517394529663 +7 2020-01-01 00:00:07 10.476517394529663 +8 2020-01-01 00:00:08 10.476517394529663 +9 2020-01-01 00:00:09 10.476517394529663 +10 2020-01-01 00:00:10 10.476517394529663 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13152195228564121686 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5718761771932584523 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +10 2020-01-01 00:00:10 1 +11 2020-01-01 00:00:11 1 +13 2020-01-01 00:00:13 1 +14 2020-01-01 00:00:14 1 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +10 2020-01-01 00:00:10 1 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 12877234599328637328 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 3447050494505378762 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.473171429072192 +3 2020-01-01 00:00:03 10.46947356535571 +4 2020-01-01 00:00:04 10.465386793917245 +5 2020-01-01 00:00:05 10.460870212974633 +6 2020-01-01 00:00:06 10.455878619067724 +7 2020-01-01 00:00:07 10.450362054646963 +8 2020-01-01 00:00:08 10.444265308081446 +9 2020-01-01 00:00:09 10.437527361082362 +10 2020-01-01 00:00:10 10.430080778011437 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4560842635161322144 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 17878131935679005193 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 1.9048374180359595 +5 2020-01-01 00:00:05 1 +7 2020-01-01 00:00:07 1.9048374180359595 +8 2020-01-01 00:00:08 1 +10 2020-01-01 00:00:10 1.9048374180359595 +11 2020-01-01 00:00:11 1 +13 2020-01-01 00:00:13 1.9048374180359595 +14 2020-01-01 00:00:14 1 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 1.9048374180359593 +3 2020-01-01 00:00:03 1.9048374180359593 +4 2020-01-01 00:00:04 1.9048374180359593 +5 2020-01-01 00:00:05 1.9048374180359593 +6 2020-01-01 00:00:06 1.9048374180359593 +7 2020-01-01 00:00:07 1.9048374180359593 +8 2020-01-01 00:00:08 1.9048374180359593 +9 2020-01-01 00:00:09 1.9048374180359593 +10 2020-01-01 00:00:10 1.9048374180359593 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8495990306826262494 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13159502210799903048 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +4 2020-01-01 00:00:04 2.5595489737597 +5 2020-01-01 00:00:05 3.3159756847533166 +7 2020-01-01 00:00:07 3.714891269566359 +8 2020-01-01 00:00:08 4.3613726246387525 +10 2020-01-01 00:00:10 4.57078989342418 +11 2020-01-01 00:00:11 5.135821725550794 +13 2020-01-01 00:00:13 5.204855189034461 +14 2020-01-01 00:00:14 5.7095477304970075 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +3 2020-01-01 00:00:03 2.723568171113941 +4 2020-01-01 00:00:04 3.4643863917956588 +5 2020-01-01 00:00:05 4.134706437831298 +6 2020-01-01 00:00:06 4.741237097543931 +7 2020-01-01 00:00:07 5.290048733637957 +8 2020-01-01 00:00:08 5.7866340374293666 +9 2020-01-01 00:00:09 6.235963001546588 +10 2020-01-01 00:00:10 6.642532661287187 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16737121499884598835 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 11839951592374520142 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 1.9048374180359595 +5 2020-01-01 00:00:05 2.5595489737597 +7 2020-01-01 00:00:07 3.3159756847533166 +8 2020-01-01 00:00:08 3.714891269566359 +10 2020-01-01 00:00:10 4.3613726246387525 +11 2020-01-01 00:00:11 4.57078989342418 +13 2020-01-01 00:00:13 5.135821725550794 +14 2020-01-01 00:00:14 5.204855189034461 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1.9048374180359595 +4 2020-01-01 00:00:04 2.723568171113941 +5 2020-01-01 00:00:05 3.4643863917956588 +6 2020-01-01 00:00:06 4.134706437831298 +7 2020-01-01 00:00:07 4.741237097543931 +8 2020-01-01 00:00:08 5.290048733637957 +9 2020-01-01 00:00:09 5.7866340374293666 +10 2020-01-01 00:00:10 6.235963001546588 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6034479436322793231 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 11997635277937493853 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.476517394529663 +4 2020-01-01 00:00:04 10.476517394529663 +5 2020-01-01 00:00:05 10.476517394529663 +6 2020-01-01 00:00:06 10.476517394529663 +7 2020-01-01 00:00:07 10.476517394529663 +8 2020-01-01 00:00:08 10.476517394529663 +9 2020-01-01 00:00:09 10.476517394529663 +10 2020-01-01 00:00:10 10.476517394529663 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13152195228564121686 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5718761771932584523 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1.9048374180359595 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1.9048374180359595 +10 2020-01-01 00:00:10 1 +11 2020-01-01 00:00:11 1.9048374180359595 +13 2020-01-01 00:00:13 1 +14 2020-01-01 00:00:14 1.9048374180359595 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1.9048374180359595 +3 2020-01-01 00:00:03 1.9048374180359593 +4 2020-01-01 00:00:04 1.9048374180359593 +5 2020-01-01 00:00:05 1.9048374180359593 +6 2020-01-01 00:00:06 1.9048374180359593 +7 2020-01-01 00:00:07 1.9048374180359593 +8 2020-01-01 00:00:08 1.9048374180359593 +9 2020-01-01 00:00:09 1.9048374180359593 +10 2020-01-01 00:00:10 1.9048374180359593 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16247217040454175541 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5513312825056761428 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.476517394529663 +2 2020-01-01 00:00:02 10.476517394529663 +3 2020-01-01 00:00:03 10.473171429072192 +4 2020-01-01 00:00:04 10.46947356535571 +5 2020-01-01 00:00:05 10.465386793917245 +6 2020-01-01 00:00:06 10.460870212974633 +7 2020-01-01 00:00:07 10.455878619067724 +8 2020-01-01 00:00:08 10.450362054646963 +9 2020-01-01 00:00:09 10.444265308081446 +10 2020-01-01 00:00:10 10.437527361082362 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16306225357017751068 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 14547466133506082998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 1.9048374180359595 +4 2020-01-01 00:00:04 1.9048374180359595 +5 2020-01-01 00:00:05 1.9048374180359595 +7 2020-01-01 00:00:07 1.9048374180359595 +8 2020-01-01 00:00:08 1.9048374180359595 +10 2020-01-01 00:00:10 1.9048374180359595 +11 2020-01-01 00:00:11 1.9048374180359595 +13 2020-01-01 00:00:13 1.9048374180359595 +14 2020-01-01 00:00:14 1.9048374180359595 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1.9048374180359595 +2 2020-01-01 00:00:02 2.723568171113941 +3 2020-01-01 00:00:03 2.723568171113941 +4 2020-01-01 00:00:04 2.723568171113941 +5 2020-01-01 00:00:05 2.723568171113941 +6 2020-01-01 00:00:06 2.723568171113941 +7 2020-01-01 00:00:07 2.723568171113941 +8 2020-01-01 00:00:08 2.723568171113941 +9 2020-01-01 00:00:09 2.723568171113941 +10 2020-01-01 00:00:10 2.723568171113941 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 12761081601402852228 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6161100718130533023 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 7.34942642590924 +2 2020-01-01 00:00:02 7.34942642590924 +4 2020-01-01 00:00:04 7.34942642590924 +5 2020-01-01 00:00:05 7.34942642590924 +7 2020-01-01 00:00:07 7.34942642590924 +8 2020-01-01 00:00:08 7.34942642590924 +10 2020-01-01 00:00:10 7.34942642590924 +11 2020-01-01 00:00:11 7.34942642590924 +13 2020-01-01 00:00:13 7.34942642590924 +14 2020-01-01 00:00:14 7.34942642590924 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 10.473171429072192 +2 2020-01-01 00:00:02 10.46947356535571 +3 2020-01-01 00:00:03 10.465386793917245 +4 2020-01-01 00:00:04 10.460870212974633 +5 2020-01-01 00:00:05 10.455878619067724 +6 2020-01-01 00:00:06 10.450362054646963 +7 2020-01-01 00:00:07 10.444265308081446 +8 2020-01-01 00:00:08 10.437527361082362 +9 2020-01-01 00:00:09 10.430080778011437 +10 2020-01-01 00:00:10 10.421851030962417 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 3475391510808484800 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedCount_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6845134164707796627 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_DateTime_time_column = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_DateTime64_time_column = r""" +id time w +0 2020-01-01 00:00:00.000 0 +1 2020-01-01 00:00:01.000 1 +2 2020-01-01 00:00:02.000 2 +3 2020-01-01 00:00:03.000 3 +4 2020-01-01 00:00:04.000 4 +5 2020-01-01 00:00:05.000 5 +6 2020-01-01 00:00:06.000 6 +7 2020-01-01 00:00:07.000 7 +8 2020-01-01 00:00:08.000 8 +9 2020-01-01 00:00:09.000 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_DateTimeTZ_time_column = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_DateTime64TZ_time_column = r""" +id time w +0 2020-01-01 00:00:00.000000000 0 +1 2020-01-01 00:00:01.000000000 1 +2 2020-01-01 00:00:02.000000000 2 +3 2020-01-01 00:00:03.000000000 3 +4 2020-01-01 00:00:04.000000000 4 +5 2020-01-01 00:00:05.000000000 5 +6 2020-01-01 00:00:06.000000000 6 +7 2020-01-01 00:00:07.000000000 7 +8 2020-01-01 00:00:08.000000000 8 +9 2020-01-01 00:00:09.000000000 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_decay_length_with_zero = r""" +id time w +0 2020-01-01 00:00:00 nan +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 nan +3 2020-01-01 00:00:03 nan +4 2020-01-01 00:00:04 nan +5 2020-01-01 00:00:05 nan +6 2020-01-01 00:00:06 nan +7 2020-01-01 00:00:07 nan +8 2020-01-01 00:00:08 nan +9 2020-01-01 00:00:09 nan +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_decay_length_with_negative = r""" +id time w +0 2020-01-01 00:00:00 21982.456886794735 +1 2020-01-01 00:00:01 21982.456886794735 +2 2020-01-01 00:00:02 21982.456886794735 +3 2020-01-01 00:00:03 21982.456886794735 +4 2020-01-01 00:00:04 21982.456886794735 +5 2020-01-01 00:00:05 21982.456886794735 +6 2020-01-01 00:00:06 21982.456886794735 +7 2020-01-01 00:00:07 21982.456886794735 +8 2020-01-01 00:00:08 21982.456886794735 +9 2020-01-01 00:00:09 21982.456886794735 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_0 = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 0 +3 2020-01-01 00:00:03 0 +4 2020-01-01 00:00:04 0 +5 2020-01-01 00:00:05 0 +6 2020-01-01 00:00:06 0 +7 2020-01-01 00:00:07 0 +8 2020-01-01 00:00:08 0 +9 2020-01-01 00:00:09 0 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_time_with_0 = r""" +id time w +0 2020-01-01 00:00:00 9999 +1 2020-01-01 00:00:01 9999 +2 2020-01-01 00:00:02 9999 +3 2020-01-01 00:00:03 9999 +4 2020-01-01 00:00:04 9999 +5 2020-01-01 00:00:05 9999 +6 2020-01-01 00:00:06 9999 +7 2020-01-01 00:00:07 9999 +8 2020-01-01 00:00:08 9999 +9 2020-01-01 00:00:09 9999 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_decay_length_overflow = r""" +id time w +0 2020-01-01 00:00:00 9999 +1 2020-01-01 00:00:01 9999 +2 2020-01-01 00:00:02 9999 +3 2020-01-01 00:00:03 9999 +4 2020-01-01 00:00:04 9999 +5 2020-01-01 00:00:05 9999 +6 2020-01-01 00:00:06 9999 +7 2020-01-01 00:00:07 9999 +8 2020-01-01 00:00:08 9999 +9 2020-01-01 00:00:09 9999 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Int8_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Int16_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Int32_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Int64_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_UInt8_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_UInt16_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_UInt32_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_UInt64_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Float32_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Float64_type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Decimal32_4__type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Decimal64_4__type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_input_value_with_Decimal128_4__type = r""" +id time exponentialTimeDecayedMax(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 3 +1 1970-01-01 03:00:02 3 +2 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:03 3 +3 1970-01-01 03:00:05 3 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_toUInt32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_toUInt64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_toFloat32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_toFloat64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_one_row_partitions = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check__1_time_gap = r""" +id time exponentialTimeDecayedMax(1)(id, time) OVER () +1 2022-01-01 00:00:00 10.87312731383618 +2 2022-01-01 00:00:00 10.87312731383618 +3 2022-01-01 00:00:00 10.87312731383618 +4 2022-01-01 00:00:01 10.87312731383618 +5 2022-01-01 00:00:00 10.87312731383618 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_0_time_gap = r""" +id time exponentialTimeDecayedMax(1)(id, time) OVER () +1 2022-01-01 00:00:00 2 +2 2022-01-01 00:00:00 2 +-3 2022-01-01 00:00:00 2 +-4 2022-01-01 00:00:00 2 +-5 2022-01-01 00:00:00 2 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 4 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 7 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 10 +10 2020-01-01 00:00:10 11 +11 2020-01-01 00:00:11 13 +13 2020-01-01 00:00:13 14 +14 2020-01-01 00:00:14 16 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 3 +3 2020-01-01 00:00:03 4 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 6 +6 2020-01-01 00:00:06 7 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 9 +9 2020-01-01 00:00:09 10 +10 2020-01-01 00:00:10 11 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8970933505069997234 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1920552523620768063 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 2 +5 2020-01-01 00:00:05 4 +7 2020-01-01 00:00:07 5 +8 2020-01-01 00:00:08 7 +10 2020-01-01 00:00:10 8 +11 2020-01-01 00:00:11 10 +13 2020-01-01 00:00:13 11 +14 2020-01-01 00:00:14 13 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 2 +4 2020-01-01 00:00:04 3 +5 2020-01-01 00:00:05 4 +6 2020-01-01 00:00:06 5 +7 2020-01-01 00:00:07 6 +8 2020-01-01 00:00:08 7 +9 2020-01-01 00:00:09 8 +10 2020-01-01 00:00:10 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13452262558908146813 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13709057447670281832 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 4 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 7 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 10 +10 2020-01-01 00:00:10 11 +11 2020-01-01 00:00:11 13 +13 2020-01-01 00:00:13 14 +14 2020-01-01 00:00:14 16 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 3 +3 2020-01-01 00:00:03 4 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 6 +6 2020-01-01 00:00:06 7 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 9 +9 2020-01-01 00:00:09 10 +10 2020-01-01 00:00:10 11 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8970933505069997234 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1920552523620768063 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13451113004697527667 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 10806118902687505865 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 11 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 14 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 3 +3 2020-01-01 00:00:03 4 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 6 +6 2020-01-01 00:00:06 7 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 9 +9 2020-01-01 00:00:09 10 +10 2020-01-01 00:00:10 11 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8970933505069997234 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16812556211937367765 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 2 +5 2020-01-01 00:00:05 4 +7 2020-01-01 00:00:07 5 +8 2020-01-01 00:00:08 7 +10 2020-01-01 00:00:10 8 +11 2020-01-01 00:00:11 10 +13 2020-01-01 00:00:13 11 +14 2020-01-01 00:00:14 13 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 2 +4 2020-01-01 00:00:04 3 +5 2020-01-01 00:00:05 4 +6 2020-01-01 00:00:06 5 +7 2020-01-01 00:00:07 6 +8 2020-01-01 00:00:08 7 +9 2020-01-01 00:00:09 8 +10 2020-01-01 00:00:10 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13452262558908146813 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13709057447670281832 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7998450438310151220 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1032201993393357875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 11 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 14 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2 +2 2020-01-01 00:00:02 3 +3 2020-01-01 00:00:03 4 +4 2020-01-01 00:00:04 5 +5 2020-01-01 00:00:05 6 +6 2020-01-01 00:00:06 7 +7 2020-01-01 00:00:07 8 +8 2020-01-01 00:00:08 9 +9 2020-01-01 00:00:09 10 +10 2020-01-01 00:00:10 11 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8970933505069997234 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16812556211937367765 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 9998 +2 2020-01-01 00:00:02 9998 +4 2020-01-01 00:00:04 9998 +5 2020-01-01 00:00:05 9998 +7 2020-01-01 00:00:07 9998 +8 2020-01-01 00:00:08 9998 +10 2020-01-01 00:00:10 9998 +11 2020-01-01 00:00:11 9998 +13 2020-01-01 00:00:13 9998 +14 2020-01-01 00:00:14 9998 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 58 +2 2020-01-01 00:00:02 58 +3 2020-01-01 00:00:03 58 +4 2020-01-01 00:00:04 58 +5 2020-01-01 00:00:05 58 +6 2020-01-01 00:00:06 58 +7 2020-01-01 00:00:07 58 +8 2020-01-01 00:00:08 58 +9 2020-01-01 00:00:09 58 +10 2020-01-01 00:00:10 58 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13451113004697527667 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedMax_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 10806118902687505865 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_DateTime_time_column = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.3678794411714423 +3 2020-01-01 00:00:03 3.8710941655794975 +4 2020-01-01 00:00:04 5.424095958355417 +5 2020-01-01 00:00:05 6.99541339002007 +6 2020-01-01 00:00:06 8.573468768683808 +7 2020-01-01 00:00:07 10.154002899524214 +8 2020-01-01 00:00:08 11.735448912330172 +9 2020-01-01 00:00:09 13.317230387764035 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_DateTime64_time_column = r""" +id time w +0 2020-01-01 00:00:00.000 0 +1 2020-01-01 00:00:01.000 1 +2 2020-01-01 00:00:02.000 2.3678794411714423 +3 2020-01-01 00:00:03.000 3.8710941655794975 +4 2020-01-01 00:00:04.000 5.424095958355417 +5 2020-01-01 00:00:05.000 6.99541339002007 +6 2020-01-01 00:00:06.000 8.573468768683808 +7 2020-01-01 00:00:07.000 10.154002899524214 +8 2020-01-01 00:00:08.000 11.735448912330172 +9 2020-01-01 00:00:09.000 13.317230387764035 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_DateTimeTZ_time_column = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.3678794411714423 +3 2020-01-01 00:00:03 3.8710941655794975 +4 2020-01-01 00:00:04 5.424095958355417 +5 2020-01-01 00:00:05 6.99541339002007 +6 2020-01-01 00:00:06 8.573468768683808 +7 2020-01-01 00:00:07 10.154002899524214 +8 2020-01-01 00:00:08 11.735448912330172 +9 2020-01-01 00:00:09 13.317230387764035 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_DateTime64TZ_time_column = r""" +id time w +0 2020-01-01 00:00:00.000000000 0 +1 2020-01-01 00:00:01.000000000 1 +2 2020-01-01 00:00:02.000000000 2.3678794411714423 +3 2020-01-01 00:00:03.000000000 3.8710941655794975 +4 2020-01-01 00:00:04.000000000 5.424095958355417 +5 2020-01-01 00:00:05.000000000 6.99541339002007 +6 2020-01-01 00:00:06.000000000 8.573468768683808 +7 2020-01-01 00:00:07.000000000 10.154002899524214 +8 2020-01-01 00:00:08.000000000 11.735448912330172 +9 2020-01-01 00:00:09.000000000 13.317230387764035 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_decay_length_with_zero = r""" +id time w +0 2020-01-01 00:00:00 nan +1 2020-01-01 00:00:01 nan +2 2020-01-01 00:00:02 nan +3 2020-01-01 00:00:03 nan +4 2020-01-01 00:00:04 nan +5 2020-01-01 00:00:05 nan +6 2020-01-01 00:00:06 nan +7 2020-01-01 00:00:07 nan +8 2020-01-01 00:00:08 nan +9 2020-01-01 00:00:09 nan +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_decay_length_with_negative = r""" +id time w +0 2020-01-01 00:00:00 21993454503.620567 +1 2020-01-01 00:00:01 21993454503.620567 +2 2020-01-01 00:00:02 21993454503.620567 +3 2020-01-01 00:00:03 21993454503.620567 +4 2020-01-01 00:00:04 21993454503.620567 +5 2020-01-01 00:00:05 21993454503.620567 +6 2020-01-01 00:00:06 21993454503.620567 +7 2020-01-01 00:00:07 21993454503.620567 +8 2020-01-01 00:00:08 21993454503.620567 +9 2020-01-01 00:00:09 21993454503.620567 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_0 = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 0 +3 2020-01-01 00:00:03 0 +4 2020-01-01 00:00:04 0 +5 2020-01-01 00:00:05 0 +6 2020-01-01 00:00:06 0 +7 2020-01-01 00:00:07 0 +8 2020-01-01 00:00:08 0 +9 2020-01-01 00:00:09 0 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_time_with_0 = r""" +id time w +0 2020-01-01 00:00:00 49995000 +1 2020-01-01 00:00:01 49995000 +2 2020-01-01 00:00:02 49995000 +3 2020-01-01 00:00:03 49995000 +4 2020-01-01 00:00:04 49995000 +5 2020-01-01 00:00:05 49995000 +6 2020-01-01 00:00:06 49995000 +7 2020-01-01 00:00:07 49995000 +8 2020-01-01 00:00:08 49995000 +9 2020-01-01 00:00:09 49995000 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_decay_length_overflow = r""" +id time w +0 2020-01-01 00:00:00 49995000 +1 2020-01-01 00:00:01 49995000 +2 2020-01-01 00:00:02 49995000 +3 2020-01-01 00:00:03 49995000 +4 2020-01-01 00:00:04 49995000 +5 2020-01-01 00:00:05 49995000 +6 2020-01-01 00:00:06 49995000 +7 2020-01-01 00:00:07 49995000 +8 2020-01-01 00:00:08 49995000 +9 2020-01-01 00:00:09 49995000 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Int8_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Int16_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Int32_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Int64_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_UInt8_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_UInt16_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_UInt32_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_UInt64_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Float32_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Float64_type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Decimal32_4__type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Decimal64_4__type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_input_value_with_Decimal128_4__type = r""" +id time exponentialTimeDecayedSum(2.2)(id, time) OVER () +1 1970-01-01 03:00:01 5.432501378740614 +1 1970-01-01 03:00:02 5.432501378740614 +2 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:03 5.432501378740614 +3 1970-01-01 03:00:05 5.432501378740614 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_toUInt32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +3 2020-01-01 00:00:03 5.628405589149901 +4 2020-01-01 00:00:04 9.09279198094556 +5 2020-01-01 00:00:05 13.227498418776857 +6 2020-01-01 00:00:06 17.96873551632079 +7 2020-01-01 00:00:07 23.258784249958747 +8 2020-01-01 00:00:08 29.045418287388113 +9 2020-01-01 00:00:09 35.281381288934696 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_toUInt64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +3 2020-01-01 00:00:03 5.628405589149901 +4 2020-01-01 00:00:04 9.09279198094556 +5 2020-01-01 00:00:05 13.227498418776857 +6 2020-01-01 00:00:06 17.96873551632079 +7 2020-01-01 00:00:07 23.258784249958747 +8 2020-01-01 00:00:08 29.045418287388113 +9 2020-01-01 00:00:09 35.281381288934696 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_toFloat32_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.909156442876713 +3 2020-01-01 00:00:03 5.6448783233776645 +4 2020-01-01 00:00:04 9.132077496953901 +5 2020-01-01 00:00:05 13.302487093205086 +6 2020-01-01 00:00:06 18.094041847071722 +7 2020-01-01 00:00:07 23.450314722946118 +8 2020-01-01 00:00:08 29.320004717853106 +9 2020-01-01 00:00:09 35.65647119441178 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_toFloat64_decay_length = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.909156442876713 +3 2020-01-01 00:00:03 5.6448783233776645 +4 2020-01-01 00:00:04 9.132077496953901 +5 2020-01-01 00:00:05 13.302487093205086 +6 2020-01-01 00:00:06 18.094041847071722 +7 2020-01-01 00:00:07 23.450314722946118 +8 2020-01-01 00:00:08 29.320004717853106 +9 2020-01-01 00:00:09 35.65647119441178 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_one_row_partitions = r""" +id time w +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check__1_time_gap = r""" +id time exponentialTimeDecayedSum(1)(id, time) OVER () +1 2022-01-01 00:00:00 21.87312731383618 +2 2022-01-01 00:00:00 21.87312731383618 +3 2022-01-01 00:00:00 21.87312731383618 +4 2022-01-01 00:00:01 21.87312731383618 +5 2022-01-01 00:00:00 21.87312731383618 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_0_time_gap = r""" +id time exponentialTimeDecayedSum(1)(id, time) OVER () +1 2022-01-01 00:00:00 -9 +2 2022-01-01 00:00:00 -9 +-3 2022-01-01 00:00:00 -9 +-4 2022-01-01 00:00:00 -9 +-5 2022-01-01 00:00:00 -9 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.8657018190976 +3 2020-01-01 00:00:03 509.8583060916646 +4 2020-01-01 00:00:04 509.8460457773492 +5 2020-01-01 00:00:05 509.8279794535788 +6 2020-01-01 00:00:06 509.8030214840442 +7 2020-01-01 00:00:07 509.76992209751967 +8 2020-01-01 00:00:08 509.7272448715611 +9 2020-01-01 00:00:09 509.6733412955684 +10 2020-01-01 00:00:10 509.60632204793006 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 14732497617511578970 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15259948609631945224 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 5.637461506155963 +4 2020-01-01 00:00:04 8.619349672143837 +5 2020-01-01 00:00:05 11.093653765389908 +7 2020-01-01 00:00:07 14.333861926251714 +8 2020-01-01 00:00:08 16.549846024623854 +10 2020-01-01 00:00:10 20.048374180359595 +11 2020-01-01 00:00:11 22.006038283857798 +13 2020-01-01 00:00:13 25.762886434467468 +14 2020-01-01 00:00:14 27.46223054309174 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 4.809674836071919 +3 2020-01-01 00:00:03 6.714512254107878 +4 2020-01-01 00:00:04 8.619349672143837 +5 2020-01-01 00:00:05 10.524187090179797 +6 2020-01-01 00:00:06 12.429024508215756 +7 2020-01-01 00:00:07 14.333861926251714 +8 2020-01-01 00:00:08 16.238699344287674 +9 2020-01-01 00:00:09 18.143536762323635 +10 2020-01-01 00:00:10 20.048374180359595 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 17864546820017591112 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 9697155262113833297 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +4 2020-01-01 00:00:04 6.378279726837681 +5 2020-01-01 00:00:05 10.771306159542913 +7 2020-01-01 00:00:07 15.818799603636073 +8 2020-01-01 00:00:08 22.313441789782324 +10 2020-01-01 00:00:10 28.26870100031019 +11 2020-01-01 00:00:11 36.57857842435122 +13 2020-01-01 00:00:13 42.9480070598911 +14 2020-01-01 00:00:14 52.86096381786202 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +3 2020-01-01 00:00:03 5.628405589149901 +4 2020-01-01 00:00:04 9.09279198094556 +5 2020-01-01 00:00:05 13.227498418776857 +6 2020-01-01 00:00:06 17.96873551632079 +7 2020-01-01 00:00:07 23.258784249958747 +8 2020-01-01 00:00:08 29.045418287388113 +9 2020-01-01 00:00:09 35.281381288934696 +10 2020-01-01 00:00:10 41.92391395022189 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8177272607092946026 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13193147715685283094 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 2.9048374180359593 +5 2020-01-01 00:00:05 6.378279726837681 +7 2020-01-01 00:00:07 10.771306159542913 +8 2020-01-01 00:00:08 15.818799603636073 +10 2020-01-01 00:00:10 22.313441789782324 +11 2020-01-01 00:00:11 28.26870100031019 +13 2020-01-01 00:00:13 36.57857842435122 +14 2020-01-01 00:00:14 42.9480070598911 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 2.9048374180359593 +4 2020-01-01 00:00:04 5.628405589149901 +5 2020-01-01 00:00:05 9.09279198094556 +6 2020-01-01 00:00:06 13.227498418776857 +7 2020-01-01 00:00:07 17.96873551632079 +8 2020-01-01 00:00:08 23.258784249958747 +9 2020-01-01 00:00:09 29.045418287388113 +10 2020-01-01 00:00:10 35.281381288934696 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 207461051412820560 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7493948266116429797 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.86904778455505 +4 2020-01-01 00:00:04 509.86904778455505 +5 2020-01-01 00:00:05 509.86904778455505 +6 2020-01-01 00:00:06 509.86904778455505 +7 2020-01-01 00:00:07 509.86904778455505 +8 2020-01-01 00:00:08 509.86904778455505 +9 2020-01-01 00:00:09 509.86904778455505 +10 2020-01-01 00:00:10 509.86904778455505 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5249260101878613678 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4835566242294516990 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +4 2020-01-01 00:00:04 5.637461506155963 +5 2020-01-01 00:00:05 8.619349672143837 +7 2020-01-01 00:00:07 11.093653765389908 +8 2020-01-01 00:00:08 14.333861926251714 +10 2020-01-01 00:00:10 16.549846024623854 +11 2020-01-01 00:00:11 20.048374180359595 +13 2020-01-01 00:00:13 22.006038283857798 +14 2020-01-01 00:00:14 25.762886434467468 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +3 2020-01-01 00:00:03 4.809674836071919 +4 2020-01-01 00:00:04 6.714512254107878 +5 2020-01-01 00:00:05 8.619349672143837 +6 2020-01-01 00:00:06 10.524187090179797 +7 2020-01-01 00:00:07 12.429024508215756 +8 2020-01-01 00:00:08 14.333861926251714 +9 2020-01-01 00:00:09 16.238699344287674 +10 2020-01-01 00:00:10 18.143536762323635 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4153748905038498474 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15879506471867999892 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.8657018190976 +4 2020-01-01 00:00:04 509.8583060916646 +5 2020-01-01 00:00:05 509.8460457773492 +6 2020-01-01 00:00:06 509.8279794535788 +7 2020-01-01 00:00:07 509.8030214840442 +8 2020-01-01 00:00:08 509.76992209751967 +9 2020-01-01 00:00:09 509.7272448715611 +10 2020-01-01 00:00:10 509.6733412955684 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1854751238588869498 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8578878731513821275 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 6.378279726837681 +4 2020-01-01 00:00:04 10.100986113507272 +5 2020-01-01 00:00:05 14.056926648116779 +7 2020-01-01 00:00:07 18.037953029660304 +8 2020-01-01 00:00:08 21.73557356939588 +10 2020-01-01 00:00:10 25.974919945813337 +11 2020-01-01 00:00:11 29.41422049067498 +13 2020-01-01 00:00:13 33.911886861966366 +14 2020-01-01 00:00:14 37.092867411954074 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 5.628405589149901 +3 2020-01-01 00:00:03 8.351973760263842 +4 2020-01-01 00:00:04 11.075541931377783 +5 2020-01-01 00:00:05 13.799110102491724 +6 2020-01-01 00:00:06 16.522678273605663 +7 2020-01-01 00:00:07 19.246246444719603 +8 2020-01-01 00:00:08 21.969814615833542 +9 2020-01-01 00:00:09 24.693382786947485 +10 2020-01-01 00:00:10 27.416950958061427 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 17177218217075523913 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4973018359321984867 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.8657018190976 +2 2020-01-01 00:00:02 509.8583060916646 +3 2020-01-01 00:00:03 509.8460457773492 +4 2020-01-01 00:00:04 509.8279794535788 +5 2020-01-01 00:00:05 509.8030214840442 +6 2020-01-01 00:00:06 509.76992209751967 +7 2020-01-01 00:00:07 509.7272448715611 +8 2020-01-01 00:00:08 509.6733412955684 +9 2020-01-01 00:00:09 509.60632204793006 +10 2020-01-01 00:00:10 509.5240245774399 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4967222295646687783 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 2316297849340719971 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.86904778455505 +4 2020-01-01 00:00:04 509.86904778455505 +5 2020-01-01 00:00:05 509.86904778455505 +6 2020-01-01 00:00:06 509.86904778455505 +7 2020-01-01 00:00:07 509.86904778455505 +8 2020-01-01 00:00:08 509.86904778455505 +9 2020-01-01 00:00:09 509.86904778455505 +10 2020-01-01 00:00:10 509.86904778455505 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5249260101878613678 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4835566242294516990 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.86904778455505 +4 2020-01-01 00:00:04 509.86904778455505 +5 2020-01-01 00:00:05 509.86904778455505 +6 2020-01-01 00:00:06 509.86904778455505 +7 2020-01-01 00:00:07 509.86904778455505 +8 2020-01-01 00:00:08 509.86904778455505 +9 2020-01-01 00:00:09 509.86904778455505 +10 2020-01-01 00:00:10 509.86904778455505 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5249260101878613678 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4835566242294516990 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.86904778455505 +4 2020-01-01 00:00:04 509.86904778455505 +5 2020-01-01 00:00:05 509.86904778455505 +6 2020-01-01 00:00:06 509.86904778455505 +7 2020-01-01 00:00:07 509.86904778455505 +8 2020-01-01 00:00:08 509.86904778455505 +9 2020-01-01 00:00:09 509.86904778455505 +10 2020-01-01 00:00:10 509.86904778455505 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5249260101878613678 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4835566242294516990 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.86904778455505 +4 2020-01-01 00:00:04 509.86904778455505 +5 2020-01-01 00:00:05 509.86904778455505 +6 2020-01-01 00:00:06 509.86904778455505 +7 2020-01-01 00:00:07 509.86904778455505 +8 2020-01-01 00:00:08 509.86904778455505 +9 2020-01-01 00:00:09 509.86904778455505 +10 2020-01-01 00:00:10 509.86904778455505 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5249260101878613678 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4835566242294516990 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 14 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2 +3 2020-01-01 00:00:03 3 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 5 +6 2020-01-01 00:00:06 6 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 8 +9 2020-01-01 00:00:09 9 +10 2020-01-01 00:00:10 10 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6912631249882696577 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 16831297400999588778 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.8657018190976 +3 2020-01-01 00:00:03 509.8583060916646 +4 2020-01-01 00:00:04 509.8460457773492 +5 2020-01-01 00:00:05 509.8279794535788 +6 2020-01-01 00:00:06 509.8030214840442 +7 2020-01-01 00:00:07 509.76992209751967 +8 2020-01-01 00:00:08 509.7272448715611 +9 2020-01-01 00:00:09 509.6733412955684 +10 2020-01-01 00:00:10 509.60632204793006 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 14732497617511578970 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 15259948609631945224 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 1.9999999999999998 +4 2020-01-01 00:00:04 8.619349672143837 +5 2020-01-01 00:00:05 4.999999999999999 +7 2020-01-01 00:00:07 14.333861926251718 +8 2020-01-01 00:00:08 8 +10 2020-01-01 00:00:10 20.048374180359595 +11 2020-01-01 00:00:11 11 +13 2020-01-01 00:00:13 25.762886434467475 +14 2020-01-01 00:00:14 14.000000000000002 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 4.809674836071919 +3 2020-01-01 00:00:03 6.714512254107878 +4 2020-01-01 00:00:04 8.619349672143837 +5 2020-01-01 00:00:05 10.524187090179797 +6 2020-01-01 00:00:06 12.429024508215756 +7 2020-01-01 00:00:07 14.333861926251714 +8 2020-01-01 00:00:08 16.238699344287674 +9 2020-01-01 00:00:09 18.143536762323635 +10 2020-01-01 00:00:10 20.048374180359595 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 17864546820017591112 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6808652788102822622 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +4 2020-01-01 00:00:04 6.378279726837681 +5 2020-01-01 00:00:05 10.771306159542913 +7 2020-01-01 00:00:07 15.818799603636073 +8 2020-01-01 00:00:08 22.313441789782324 +10 2020-01-01 00:00:10 28.26870100031019 +11 2020-01-01 00:00:11 36.57857842435122 +13 2020-01-01 00:00:13 42.9480070598911 +14 2020-01-01 00:00:14 52.86096381786202 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +3 2020-01-01 00:00:03 5.628405589149901 +4 2020-01-01 00:00:04 9.09279198094556 +5 2020-01-01 00:00:05 13.227498418776857 +6 2020-01-01 00:00:06 17.96873551632079 +7 2020-01-01 00:00:07 23.258784249958747 +8 2020-01-01 00:00:08 29.045418287388113 +9 2020-01-01 00:00:09 35.281381288934696 +10 2020-01-01 00:00:10 41.92391395022189 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 8177272607092946026 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 13193147715685283094 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +4 2020-01-01 00:00:04 2.9048374180359593 +5 2020-01-01 00:00:05 6.378279726837681 +7 2020-01-01 00:00:07 10.771306159542913 +8 2020-01-01 00:00:08 15.818799603636073 +10 2020-01-01 00:00:10 22.313441789782324 +11 2020-01-01 00:00:11 28.26870100031019 +13 2020-01-01 00:00:13 36.57857842435122 +14 2020-01-01 00:00:14 42.9480070598911 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 0 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 2.9048374180359593 +4 2020-01-01 00:00:04 5.628405589149901 +5 2020-01-01 00:00:05 9.09279198094556 +6 2020-01-01 00:00:06 13.227498418776857 +7 2020-01-01 00:00:07 17.96873551632079 +8 2020-01-01 00:00:08 23.258784249958747 +9 2020-01-01 00:00:09 29.045418287388113 +10 2020-01-01 00:00:10 35.281381288934696 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 207461051412820560 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 7493948266116429797 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.86904778455505 +4 2020-01-01 00:00:04 509.86904778455505 +5 2020-01-01 00:00:05 509.86904778455505 +6 2020-01-01 00:00:06 509.86904778455505 +7 2020-01-01 00:00:07 509.86904778455505 +8 2020-01-01 00:00:08 509.86904778455505 +9 2020-01-01 00:00:09 509.86904778455505 +10 2020-01-01 00:00:10 509.86904778455505 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 5249260101878613678 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4835566242294516990 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__basic_check = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +4 2020-01-01 00:00:04 4 +5 2020-01-01 00:00:05 8.619349672143837 +7 2020-01-01 00:00:07 7 +8 2020-01-01 00:00:08 14.333861926251718 +10 2020-01-01 00:00:10 10 +11 2020-01-01 00:00:11 20.048374180359595 +13 2020-01-01 00:00:13 13 +14 2020-01-01 00:00:14 25.762886434467475 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 2.9048374180359593 +3 2020-01-01 00:00:03 4.809674836071919 +4 2020-01-01 00:00:04 6.714512254107878 +5 2020-01-01 00:00:05 8.619349672143837 +6 2020-01-01 00:00:06 10.524187090179797 +7 2020-01-01 00:00:07 12.429024508215756 +8 2020-01-01 00:00:08 14.333861926251714 +9 2020-01-01 00:00:09 16.238699344287674 +10 2020-01-01 00:00:10 18.143536762323635 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4153748905038498474 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 3478934939339647691 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.86904778455505 +2 2020-01-01 00:00:02 509.86904778455505 +3 2020-01-01 00:00:03 509.8657018190976 +4 2020-01-01 00:00:04 509.8583060916646 +5 2020-01-01 00:00:05 509.8460457773492 +6 2020-01-01 00:00:06 509.8279794535788 +7 2020-01-01 00:00:07 509.8030214840442 +8 2020-01-01 00:00:08 509.76992209751967 +9 2020-01-01 00:00:09 509.7272448715611 +10 2020-01-01 00:00:10 509.6733412955684 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 1854751238588869498 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 6699689522961227875 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 2.9048374180359593 +4 2020-01-01 00:00:04 8.619349672143837 +5 2020-01-01 00:00:05 8.619349672143837 +7 2020-01-01 00:00:07 14.333861926251718 +8 2020-01-01 00:00:08 14.333861926251718 +10 2020-01-01 00:00:10 20.048374180359595 +11 2020-01-01 00:00:11 20.048374180359595 +13 2020-01-01 00:00:13 25.762886434467475 +14 2020-01-01 00:00:14 25.762886434467475 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 2.9048374180359593 +2 2020-01-01 00:00:02 5.628405589149901 +3 2020-01-01 00:00:03 8.351973760263842 +4 2020-01-01 00:00:04 11.075541931377783 +5 2020-01-01 00:00:05 13.799110102491724 +6 2020-01-01 00:00:06 16.522678273605663 +7 2020-01-01 00:00:07 19.246246444719603 +8 2020-01-01 00:00:08 21.969814615833542 +9 2020-01-01 00:00:09 24.693382786947485 +10 2020-01-01 00:00:10 27.416950958061427 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 17177218217075523913 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 320451493116528259 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__basic_check = r""" +id time w +1 2020-01-01 00:00:01 73413.05376916874 +2 2020-01-01 00:00:02 73413.05376916874 +4 2020-01-01 00:00:04 73413.05376916874 +5 2020-01-01 00:00:05 73413.05376916874 +7 2020-01-01 00:00:07 73413.05376916874 +8 2020-01-01 00:00:08 73413.05376916874 +10 2020-01-01 00:00:10 73413.05376916874 +11 2020-01-01 00:00:11 73413.05376916874 +13 2020-01-01 00:00:13 73413.05376916874 +14 2020-01-01 00:00:14 73413.05376916874 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__check_with_partition_by_minute = r""" +id time w +1 2020-01-01 00:00:01 509.8657018190976 +2 2020-01-01 00:00:02 509.8583060916646 +3 2020-01-01 00:00:03 509.8460457773492 +4 2020-01-01 00:00:04 509.8279794535788 +5 2020-01-01 00:00:05 509.8030214840442 +6 2020-01-01 00:00:06 509.76992209751967 +7 2020-01-01 00:00:07 509.7272448715611 +8 2020-01-01 00:00:08 509.6733412955684 +9 2020-01-01 00:00:09 509.60632204793006 +10 2020-01-01 00:00:10 509.5240245774399 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 4967222295646687783 +""" + +_window_functions_tests_time_decayed_funcs_exponentialTimeDecayedSum_check_over_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING__full_table_with_partition_by_minute = r""" +anyLast(id) anyLast(time) cityHash64(groupArray(w)) +9999 2020-01-01 02:46:39 2316297849340719971 +""" + +_window_functions_tests_non_negative_derivative_func_check_intervals_valid_SECOND = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_intervals_valid_MINUTE = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 60 +2 2020-01-01 00:00:02 60 +3 2020-01-01 00:00:03 60 +4 2020-01-01 00:00:04 60 +5 2020-01-01 00:00:05 60 +6 2020-01-01 00:00:06 60 +7 2020-01-01 00:00:07 60 +8 2020-01-01 00:00:08 60 +9 2020-01-01 00:00:09 60 +""" + +_window_functions_tests_non_negative_derivative_func_check_intervals_valid_HOUR = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 3600 +2 2020-01-01 00:00:02 3600 +3 2020-01-01 00:00:03 3600 +4 2020-01-01 00:00:04 3600 +5 2020-01-01 00:00:05 3600 +6 2020-01-01 00:00:06 3600 +7 2020-01-01 00:00:07 3600 +8 2020-01-01 00:00:08 3600 +9 2020-01-01 00:00:09 3600 +""" + +_window_functions_tests_non_negative_derivative_func_check_intervals_valid_DAY = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 86400 +2 2020-01-01 00:00:02 86400 +3 2020-01-01 00:00:03 86400 +4 2020-01-01 00:00:04 86400 +5 2020-01-01 00:00:05 86400 +6 2020-01-01 00:00:06 86400 +7 2020-01-01 00:00:07 86400 +8 2020-01-01 00:00:08 86400 +9 2020-01-01 00:00:09 86400 +""" + +_window_functions_tests_non_negative_derivative_func_check_intervals_valid_WEEK = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 604800 +2 2020-01-01 00:00:02 604800 +3 2020-01-01 00:00:03 604800 +4 2020-01-01 00:00:04 604800 +5 2020-01-01 00:00:05 604800 +6 2020-01-01 00:00:06 604800 +7 2020-01-01 00:00:07 604800 +8 2020-01-01 00:00:08 604800 +9 2020-01-01 00:00:09 604800 +""" + +_window_functions_tests_non_negative_derivative_func_check_one_row_per_partition = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_1_PRECEDING_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_1_PRECEDING_AND_1_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ROWS_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_CURRENT_ROW_AND_1_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_1_PRECEDING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_UNBOUNDED_PRECEDING_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_CURRENT_ROW = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_1_PRECEDING_AND_1_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_check_over_windows_ORDER_BY_id_RANGE_BETWEEN_1_FOLLOWING_AND_UNBOUNDED_FOLLOWING = r""" +id f_timestamp nnd +0 2020-01-01 00:00:00 0 +1 2020-01-01 00:00:01 1 +2 2020-01-01 00:00:02 1 +3 2020-01-01 00:00:03 1 +4 2020-01-01 00:00:04 1 +5 2020-01-01 00:00:05 1 +6 2020-01-01 00:00:06 1 +7 2020-01-01 00:00:07 1 +8 2020-01-01 00:00:08 1 +9 2020-01-01 00:00:09 1 +""" + +_window_functions_tests_non_negative_derivative_func_division_by_tiny_numerator_is_non_zero = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00.000000000 0 +2 2 2022-12-12 00:00:00.000000001 0 +3 3 2022-12-12 00:00:00.000000002 0 +""" + +_window_functions_tests_non_negative_derivative_func_division_by_tiny_numerator_is_zero = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00.000000000 0 +2 1 2022-12-12 00:00:00.000000001 0 +3 1 2022-12-12 00:00:00.000000002 0 +""" + +_window_functions_tests_non_negative_derivative_func_division_by_zero = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 1 2022-12-12 00:00:00 0 +""" + +_window_functions_tests_non_negative_derivative_func_empty_table = r""" +id metric ts nnd +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Float32 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Float64 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_UInt8 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_UInt16 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_UInt32 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_UInt64 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Int8 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Int16 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Int32 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Int64 = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Decimal32_4_ = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Decimal64_4_ = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_metric_types_Decimal128_4_ = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_timestamp_types_DateTime = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_timestamp_types_DateTime64_0_ = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00 0 +2 2 2022-12-12 00:00:01 1 +3 3 2022-12-12 00:00:02 1 +""" + +_window_functions_tests_non_negative_derivative_func_valid_timestamp_types_DateTime64_3__EST_ = r""" +id metric ts nnd +1 1 2022-12-12 00:00:00.000 0 +2 2 2022-12-12 00:00:01.000 1 +3 3 2022-12-12 00:00:02.000 1 +""" + +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__studentTTest_salary__1__ = r""" func (nan,0) (nan,0) @@ -796,7 +6235,7 @@ func (nan,0) """ -func__welchTTest_salary__1__ = r""" +_window_functions_tests_aggregate_funcs_aggregate_funcs_over_rows_frame_func__welchTTest_salary__1__ = r""" func (nan,0) (nan,0) @@ -810,17 +6249,3 @@ func (nan,0) """ -func__median_salary__ = r""" -func -4800 -4800 -4900 -5000 -5100 -5200 -5200 -5200 -5600 -6000 -""" - diff --git a/tests/testflows/window_functions/tests/time_decayed_funcs.py b/tests/testflows/window_functions/tests/time_decayed_funcs.py new file mode 100644 index 00000000000..e6045fb6e20 --- /dev/null +++ b/tests/testflows/window_functions/tests/time_decayed_funcs.py @@ -0,0 +1,387 @@ +from testflows.core import * + +from window_functions.requirements import * +from window_functions.tests.common import * + + +@TestOutline +def exponentialTimeDecayedFunc( + self, funcname, extremely_large_number_of_arguments=1000 +): + """Check exponentialTimeDecayed functions such as + exponentialTimeDecayedSum, exponentialTimeDecayedMax and exponentialTimeDecayedAvg. + """ + decay_datatypes = ["toUInt32", "toUInt64", "toFloat32", "toFloat64"] + + value_datatypes = [ + "Int8", + "Int16", + "Int32", + "Int64", + "UInt8", + "UInt16", + "UInt32", + "UInt64", + "Float32", + "Float64", + "Decimal32(4)", + "Decimal64(4)", + "Decimal128(4)", + ] + + unsupported_value_datatypes = [ + "DateTime", + "DateTime64", + "Nullable(Int8)", + "Nullable(Float32)", + ] + + time_columns = [ + ("DateTime", "f_timestamp"), + ("DateTime64", "f_timestamp64"), + ("DateTimeTZ", "f_timestamptz"), + ("DateTime64TZ", "f_timestamp64tz"), + ] + + for time_datatype, time_column in time_columns: + with Example(f"{time_datatype} time column"): + execute_query( + f"SELECT id, {time_column} AS time, {funcname}(1)(id, {time_column}) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example("check decay length with zero"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(0)(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example("check decay length with INTERVAL"): + for interval_period in interval_periods: + r = execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(INTERVAL 5 {interval_period})(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + no_checks=True, + ) + assert r.exitcode != 0, error("should return an error") + + with Example("check decay length with negative"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(-1000)(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example("check decay length with invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1,2)(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"Exception: Function {funcname} takes exactly one parameter", + ) + + with Example("check decay length with extremely large invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}({','.join(['1']*extremely_large_number_of_arguments)})(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"Exception: Function {funcname} takes exactly one parameter", + ) + + with Example("check decay length with column argument"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(id)(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=47, + message=f"Exception: ", + ) + + with Example("check input value with 0"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1)(0, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + ) + + with Example("check input time with 0"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1)(id, 0) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + ) + + with Example("check invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1)(id, id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"DB::Exception: Function {funcname} takes exactly two arguments", + ) + + with Example("check extremely large invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1)(id, f_timestamp, {','.join(['id']*extremely_large_number_of_arguments)}) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"DB::Exception: Function {funcname} takes exactly two arguments", + ) + + with Example("check decay length overflow"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1000000000000000000000000000000000000000000000000000000000000000)(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example(f"check using as a non-window aggregate function"): + execute_query( + f"SELECT anyLast(id), anyLast(time), {funcname}(10)(id, time) FROM values('id Int8, time DateTime', (1,1),(1,2),(2,3),(3,3),(3,5))", + exitcode=36, + message=f"Exception: The function '{funcname}' can only be used as a window function, not as an aggregate function", + ) + + for data_type in [ + "Nullable(DateTime)", + "Nullable(DateTime64)", + "Nullable(Int8)", + "Nullable(Float32)", + ]: + with Example(f"check input time with unsupported {data_type} type"): + execute_query( + f"SELECT id, time, {funcname}(1)(id, time) OVER () FROM values('id Int8, time Nullable(DateTime)', (1,1),(1,2),(2,3),(3,NULL),(3,5))", + message="Exception: Argument 1 must be DateTime, DateTime64 or a number", + exitcode=36, + ) + + for data_type in value_datatypes: + with Example(f"check input value with {data_type} type"): + execute_query( + f"SELECT id, time, {funcname}(2.2)(id, time) OVER () FROM values('id {data_type}, time DateTime', (1,1),(1,2),(2,3),(3,3),(3,5))", + ) + + for data_type in unsupported_value_datatypes: + with Example(f"check input value with unsupported {data_type} type"): + execute_query( + f"SELECT id, time, {funcname}(2.2)(id, time) OVER () FROM values('id {data_type}, time DateTime', (1,1),(1,2),(2,3),(3,4),(3,5))", + exitcode=36, + message="Exception: Argument 0 must be a number", + ) + + for decay_datatype in decay_datatypes: + with Example(f"{decay_datatype} decay length"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}({decay_datatype}(10.5))(id, f_timestamp) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS w FROM datetimes2 ORDER BY id LIMIT 10", + ) + + with Example("check one row partitions"): + execute_query( + f"SELECT id, time, w FROM (SELECT id, f_timestamp AS time, {funcname}(10)(id, f_timestamp) OVER (PARTITION BY id) AS w FROM (SELECT * FROM datetimes2 ORDER BY id LIMIT 10))" + ) + + with Example(f"check -1 time gap"): + execute_query( + f"SELECT id, time, {funcname}(1)(id, time) OVER () FROM values('id Int8, time DateTime', (1,'2022-01-01 00:00:00'),(2,'2022-01-01 00:00:00'),(3,'2022-01-01 00:00:00'),(4,'2022-01-01 00:00:01'),(5,'2022-01-01 00:00:00'))", + ) + + with Example(f"check 0 time gap"): + execute_query( + f"SELECT id, time, {funcname}(1)(id, time) OVER () FROM values('id Int8, time DateTime', (1,'2022-01-01 00:00:00'),(2,'2022-01-01 00:00:00'),(-3,'2022-01-01 00:00:00'),(-4,'2022-01-01 00:00:00'),(-5,'2022-01-01 00:00:00'))", + ) + + for window in windows(order_by="id"): + with Check(f"check over({window})"): + with Example("basic check"): + execute_query( + f"SELECT id, time, w FROM (SELECT id, f_timestamp AS time, {funcname}(10)(id, f_timestamp) OVER ({window}) AS w FROM datetimes2 WHERE id % 3 ORDER BY id LIMIT 10)" + ) + with Example("check with partition by minute"): + execute_query( + f"SELECT id, time, w FROM (SELECT id, f_timestamp AS time, {funcname}(10)(id, f_timestamp) OVER (PARTITION BY toStartOfMinute(f_timestamp) {window}) AS w FROM datetimes2 WHERE id % 59 ORDER BY id LIMIT 10)" + ) + with Example("full table"): + execute_query( + f"SELECT anyLast(id), anyLast(time), cityHash64(groupArray(w)) FROM (SELECT id, f_timestamp AS time, {funcname}(1)(id, f_timestamp) OVER ({window}) AS w FROM datetimes2 ORDER BY id)" + ) + with Example("full table with partition by minute"): + execute_query( + f"SELECT anyLast(id), anyLast(time), cityHash64(groupArray(w)) FROM (SELECT id, f_timestamp AS time, {funcname}(1)(id, f_timestamp) OVER (PARTITION BY toStartOfMinute(f_timestamp) {window}) AS w FROM datetimes2 WHERE id % 59 ORDER BY id)" + ) + + +@TestScenario +def exponentialTimeDecayedSum(self): + """Check exponentialTimeDecayedSum.""" + exponentialTimeDecayedFunc(funcname="exponentialTimeDecayedSum") + + +@TestScenario +def exponentialTimeDecayedMax(self): + """Check exponentialTimeDecayedMax.""" + exponentialTimeDecayedFunc(funcname="exponentialTimeDecayedMax") + + +@TestScenario +def exponentialTimeDecayedAvg(self): + """Check exponentialTimeDecayedAvg.""" + exponentialTimeDecayedFunc(funcname="exponentialTimeDecayedAvg") + + +@TestScenario +def exponentialTimeDecayedCount(self, extremely_large_number_of_arguments=1000): + """Check exponentialTimeDecayedCount function.""" + funcname = "exponentialTimeDecayedCount" + + decay_datatypes = ["toUInt32", "toUInt64", "toFloat32", "toFloat64"] + + value_datatypes = [ + "Int8", + "Int16", + "Int32", + "Int64", + "UInt8", + "UInt16", + "UInt32", + "UInt64", + "Float32", + "Float64", + "Decimal32(4)", + "Decimal64(4)", + "Decimal128(4)", + ] + + unsupported_value_datatypes = [ + "DateTime", + "DateTime64", + "Nullable(Int8)", + "Nullable(Float32)", + ] + + time_columns = [ + ("DateTime", "f_timestamp"), + ("DateTime64", "f_timestamp64"), + ("DateTimeTZ", "f_timestamptz"), + ("DateTime64TZ", "f_timestamp64tz"), + ] + + for time_datatype, time_column in time_columns: + with Example(f"{time_datatype} time column"): + execute_query( + f"SELECT id, {time_column} AS time, {funcname}(1)({time_column}) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example("check decay length with zero"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(0)(f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example("check decay length with INTERVAL"): + for interval_period in interval_periods: + r = execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(INTERVAL 5 {interval_period})(f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + no_checks=True, + ) + assert r.exitcode != 0, error("should return an error") + + with Example("check decay length with negative"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(-1000)(f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example("check decay length with invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1,2)(f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"Exception: Function {funcname} takes exactly one parameter", + ) + + with Example("check decay length with extremely large invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}({','.join(['1']*extremely_large_number_of_arguments)})(f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"Exception: Function {funcname} takes exactly one parameter", + ) + + with Example("check invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1)(id, f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"DB::Exception: Function {funcname} takes exactly one argument", + ) + + with Example("check extremely large invalid number of arguments"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1)(f_timestamp, {','.join(['f_timestamp']*extremely_large_number_of_arguments)}) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=36, + message=f"DB::Exception: Function {funcname} takes exactly one argument", + ) + + with Example("check decay length overflow"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1000000000000000000000000000000000000000000000000000000000000000)(f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10" + ) + + with Example("check decay length with column argument"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(id)(f_timestamp) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + exitcode=47, + message=f"Exception: ", + ) + + with Example("check input time with 0"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}(1)(0) OVER () AS w FROM datetimes2 ORDER BY id LIMIT 10", + ) + + with Example(f"check using as a non-window aggregate function"): + execute_query( + f"SELECT anyLast(id), anyLast(time), {funcname}(10)(time) FROM values('id Int8, time DateTime', (1,1),(1,2),(2,3),(3,3),(3,5))", + exitcode=36, + message=f"Exception: The function '{funcname}' can only be used as a window function, not as an aggregate function", + ) + + for data_type in [ + "Nullable(DateTime)", + "Nullable(DateTime64)", + "Nullable(Int8)", + "Nullable(Float32)", + ]: + with Example(f"check input time with unsupported {data_type} type"): + execute_query( + f"SELECT id, time, {funcname}(1)(time) OVER () FROM values('id Int8, time Nullable(DateTime)', (1,1),(2,2),(2,3),(3,NULL),(3,5))", + message="Exception: Argument 0 must be DateTime, DateTime64 or a number", + exitcode=36, + ) + + for decay_datatype in decay_datatypes: + with Example(f"{decay_datatype} decay length"): + execute_query( + f"SELECT id, f_timestamp AS time, {funcname}({decay_datatype}(10.5))(f_timestamp) OVER (ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS w FROM datetimes2 ORDER BY id LIMIT 10", + ) + + with Example("check one row partitions"): + execute_query( + f"SELECT id, time, w FROM (SELECT id, f_timestamp AS time, {funcname}(10)(f_timestamp) OVER (PARTITION BY id) AS w FROM (SELECT * FROM datetimes2 ORDER BY id LIMIT 10))" + ) + + with Example(f"check -1 time gap"): + execute_query( + f"SELECT id, time, {funcname}(1)(time) OVER () FROM values('id Int8, time DateTime', (1,'2022-01-01 00:00:00'),(2,'2022-01-01 00:00:00'),(3,'2022-01-01 00:00:00'),(4,'2022-01-01 00:00:01'),(5,'2022-01-01 00:00:00'))", + ) + + with Example(f"check 0 time gap"): + execute_query( + f"SELECT id, time, {funcname}(1)(time) OVER () FROM values('id Int8, time DateTime', (1,'2022-01-01 00:00:00'),(2,'2022-01-01 00:00:00'),(-3,'2022-01-01 00:00:00'),(-4,'2022-01-01 00:00:00'),(-5,'2022-01-01 00:00:00'))", + ) + + for window in windows(order_by="id"): + with Check(f"check over({window})"): + with Example("basic check"): + execute_query( + f"SELECT id, time, w FROM (SELECT id, f_timestamp AS time, {funcname}(10)(f_timestamp) OVER ({window}) AS w FROM datetimes2 WHERE id % 3 ORDER BY id LIMIT 10)" + ) + with Example("check with partition by minute"): + execute_query( + f"SELECT id, time, w FROM (SELECT id, f_timestamp AS time, {funcname}(10)(f_timestamp) OVER (PARTITION BY toStartOfMinute(f_timestamp) {window}) AS w FROM datetimes2 WHERE id % 59 ORDER BY id LIMIT 10)" + ) + with Example("full table"): + execute_query( + f"SELECT anyLast(id), anyLast(time), cityHash64(groupArray(w)) FROM (SELECT id, f_timestamp AS time, {funcname}(1)(f_timestamp) OVER ({window}) AS w FROM datetimes2 ORDER BY id)" + ) + with Example("full table with partition by minute"): + execute_query( + f"SELECT anyLast(id), anyLast(time), cityHash64(groupArray(w)) FROM (SELECT id, f_timestamp AS time, {funcname}(1)(f_timestamp) OVER (PARTITION BY toStartOfMinute(f_timestamp) {window}) AS w FROM datetimes2 WHERE id % 59 ORDER BY id)" + ) + + +@TestFeature +@Name("time decayed funcs") +@Requirements(RQ_SRS_019_ClickHouse_WindowFunctions_ExponentialTimeDecayed("1.0")) +@Skipped("only for >=22.3", check_clickhouse_version("<22.3.10")) +def feature(self): + """Check time decayed window functions.""" + for scenario in loads(current_module(), Scenario): + Scenario(run=scenario, flags=TE) diff --git a/tests/testflows/window_functions/window_functions_env/clickhouse-service.yml b/tests/testflows/window_functions/window_functions_env/clickhouse-service.yml index afb31f77c94..cb2cbc78cd5 100755 --- a/tests/testflows/window_functions/window_functions_env/clickhouse-service.yml +++ b/tests/testflows/window_functions/window_functions_env/clickhouse-service.yml @@ -2,14 +2,16 @@ version: '2.3' services: clickhouse: - image: clickhouse/integration-test + image: ${IMAGE_DEPENDENCY_PROXY}clickhouse/clickhouse-integration-test:28741 expose: - "9000" - "9009" - "8123" volumes: - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d:/etc/clickhouse-server/config.d" - - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.d:/etc/clickhouse-server/users.d" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" diff --git a/tests/testflows/window_functions/window_functions_env/docker-compose.yml b/tests/testflows/window_functions/window_functions_env/docker-compose.yml index 29f2ef52470..c9ae33d7884 100755 --- a/tests/testflows/window_functions/window_functions_env/docker-compose.yml +++ b/tests/testflows/window_functions/window_functions_env/docker-compose.yml @@ -48,7 +48,7 @@ services: # dummy service which does nothing, but allows to postpone # 'docker-compose up -d' till all dependecies will go healthy all_services_ready: - image: hello-world + image: ${IMAGE_DEPENDENCY_PROXY}hello-world depends_on: clickhouse1: condition: service_healthy diff --git a/tests/testflows/window_functions/window_functions_env/zookeeper-service.yml b/tests/testflows/window_functions/window_functions_env/zookeeper-service.yml index f3df33358be..60c0e4e7de3 100755 --- a/tests/testflows/window_functions/window_functions_env/zookeeper-service.yml +++ b/tests/testflows/window_functions/window_functions_env/zookeeper-service.yml @@ -2,7 +2,7 @@ version: '2.3' services: zookeeper: - image: zookeeper:3.4.12 + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 expose: - "2181" environment: diff --git a/tests/testflows/window_functions/window_functions_env_arm64/clickhouse-service.yml b/tests/testflows/window_functions/window_functions_env_arm64/clickhouse-service.yml new file mode 100755 index 00000000000..7ff8dc1c14b --- /dev/null +++ b/tests/testflows/window_functions/window_functions_env_arm64/clickhouse-service.yml @@ -0,0 +1,30 @@ +version: '2.3' + +services: + clickhouse: + image: registry.gitlab.com/altinity-public/container-images/test/clickhouse-integration-test:21.12 + privileged: true + expose: + - "9000" + - "9009" + - "8123" + volumes: + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/logs.xml:/etc/clickhouse-server/config.d/logs.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/remote.xml:/etc/clickhouse-server/config.d/remote.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/zookeeper.xml:/etc/clickhouse-server/config.d/zookeeper.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/config.xml:/etc/clickhouse-server/config.xml" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse/users.xml:/etc/clickhouse-server/users.xml" + - "${CLICKHOUSE_TESTS_SERVER_BIN_PATH:-/usr/bin/clickhouse}:/usr/bin/clickhouse" + - "${CLICKHOUSE_TESTS_ODBC_BRIDGE_BIN_PATH:-/usr/bin/clickhouse-odbc-bridge}:/usr/bin/clickhouse-odbc-bridge" + entrypoint: bash -c "clickhouse server --config-file=/etc/clickhouse-server/config.xml --log-file=/var/log/clickhouse-server/clickhouse-server.log --errorlog-file=/var/log/clickhouse-server/clickhouse-server.err.log" + healthcheck: + test: clickhouse client --query='select 1' + interval: 10s + timeout: 10s + retries: 3 + start_period: 300s + cap_add: + - SYS_PTRACE + security_opt: + - label:disable diff --git a/tests/testflows/window_functions/window_functions_env_arm64/docker-compose.yml b/tests/testflows/window_functions/window_functions_env_arm64/docker-compose.yml new file mode 100755 index 00000000000..c9ae33d7884 --- /dev/null +++ b/tests/testflows/window_functions/window_functions_env_arm64/docker-compose.yml @@ -0,0 +1,60 @@ +version: '2.3' + +services: + zookeeper: + extends: + file: zookeeper-service.yml + service: zookeeper + + clickhouse1: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse1 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse1/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse1/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse2: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse2 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse2/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse2/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + depends_on: + zookeeper: + condition: service_healthy + + clickhouse3: + extends: + file: clickhouse-service.yml + service: clickhouse + hostname: clickhouse3 + volumes: + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/database/:/var/lib/clickhouse/" + - "${CLICKHOUSE_TESTS_DIR}/_instances/clickhouse3/logs/:/var/log/clickhouse-server/" + - "${CLICKHOUSE_TESTS_DIR}/configs/clickhouse3/config.d/macros.xml:/etc/clickhouse-server/config.d/macros.xml" + depends_on: + zookeeper: + condition: service_healthy + + # dummy service which does nothing, but allows to postpone + # 'docker-compose up -d' till all dependecies will go healthy + all_services_ready: + image: ${IMAGE_DEPENDENCY_PROXY}hello-world + depends_on: + clickhouse1: + condition: service_healthy + clickhouse2: + condition: service_healthy + clickhouse3: + condition: service_healthy + zookeeper: + condition: service_healthy diff --git a/tests/testflows/window_functions/window_functions_env_arm64/zookeeper-service.yml b/tests/testflows/window_functions/window_functions_env_arm64/zookeeper-service.yml new file mode 100755 index 00000000000..60c0e4e7de3 --- /dev/null +++ b/tests/testflows/window_functions/window_functions_env_arm64/zookeeper-service.yml @@ -0,0 +1,18 @@ +version: '2.3' + +services: + zookeeper: + image: ${IMAGE_DEPENDENCY_PROXY}zookeeper:3.6.2 + expose: + - "2181" + environment: + ZOO_TICK_TIME: 500 + ZOO_MY_ID: 1 + healthcheck: + test: echo stat | nc localhost 2181 + interval: 3s + timeout: 2s + retries: 5 + start_period: 2s + security_opt: + - label:disable diff --git a/utils/clickhouse-docker b/utils/clickhouse-docker index cfe515f1de5..34b637f0eaa 100755 --- a/utils/clickhouse-docker +++ b/utils/clickhouse-docker @@ -26,11 +26,11 @@ then # https://stackoverflow.com/a/39454426/1555175 wget -nv https://registry.hub.docker.com/v1/repositories/clickhouse/clickhouse-server/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}' else - docker pull clickhouse/clickhouse-server:${param} + docker pull altinityinfra/clickhouse-server:${param} tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) # older version require /nonexistent folder to exist to run clickhouse client :D chmod 777 ${tmp_dir} set -e - containerid=`docker run -v${tmp_dir}:/nonexistent -d clickhouse/clickhouse-server:${param}` + containerid=`docker run -v${tmp_dir}:/nonexistent -d altinityinfra/clickhouse-server:${param}` set +e while : do