diff --git a/.github/workflows/backport_branches.yml b/.github/workflows/backport_branches.yml
index 9645d0e46de..50f4f503f5d 100644
--- a/.github/workflows/backport_branches.yml
+++ b/.github/workflows/backport_branches.yml
@@ -241,8 +241,9 @@ jobs:
runner_type: stress-tester
data: ${{ needs.RunConfig.outputs.data }}
FinishCheck:
- if: ${{ !failure() && !cancelled() }}
+ if: ${{ !cancelled() }}
needs:
+ - RunConfig
- Builds_Report
- FunctionalStatelessTestAsan
- FunctionalStatefulTestDebug
@@ -257,6 +258,7 @@ jobs:
with:
clear-repository: true
- name: Finish label
+ if: ${{ !failure() }}
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
# update mergeable check
@@ -264,3 +266,13 @@ jobs:
# update overall ci report
python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
python3 merge_pr.py
+ - name: Check Workflow results
+ run: |
+ export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json"
+ cat >> "$WORKFLOW_RESULT_FILE" << 'EOF'
+ ${{ toJson(needs) }}
+ EOF
+ echo "::group::Workflow results"
+ python3 -m json.tool "$WORKFLOW_RESULT_FILE"
+ echo "::endgroup::"
+ python3 ./tests/ci/ci_buddy.py --check-wf-status
diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml
index 09acef5eb8b..b28d87ee31f 100644
--- a/.github/workflows/master.yml
+++ b/.github/workflows/master.yml
@@ -121,34 +121,6 @@ jobs:
runner_type: style-checker-aarch64
data: ${{ needs.RunConfig.outputs.data }}
- MarkReleaseReady:
- if: ${{ !failure() && !cancelled() }}
- needs: [RunConfig, Builds_1, Builds_2]
- runs-on: [self-hosted, style-checker-aarch64]
- steps:
- - name: Debug
- run: |
- echo need with different filters
- cat << 'EOF'
- ${{ toJSON(needs) }}
- ${{ toJSON(needs.*.result) }}
- no failures ${{ !contains(needs.*.result, 'failure') }}
- no skips ${{ !contains(needs.*.result, 'skipped') }}
- no both ${{ !(contains(needs.*.result, 'skipped') || contains(needs.*.result, 'failure')) }}
- EOF
- - name: Not ready
- # fail the job to be able to restart it
- if: ${{ contains(needs.*.result, 'skipped') || contains(needs.*.result, 'failure') }}
- run: exit 1
- - name: Check out repository code
- if: ${{ ! (contains(needs.*.result, 'skipped') || contains(needs.*.result, 'failure')) }}
- uses: ClickHouse/checkout@v1
- - name: Mark Commit Release Ready
- if: ${{ ! (contains(needs.*.result, 'skipped') || contains(needs.*.result, 'failure')) }}
- run: |
- cd "$GITHUB_WORKSPACE/tests/ci"
- python3 mark_release_ready.py
-
FinishCheck:
if: ${{ !cancelled() }}
needs: [RunConfig, Builds_1, Builds_2, Builds_Report, Tests_1, Tests_2, Tests_3]
@@ -160,3 +132,13 @@ jobs:
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
+ - name: Check Workflow results
+ run: |
+ export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json"
+ cat >> "$WORKFLOW_RESULT_FILE" << 'EOF'
+ ${{ toJson(needs) }}
+ EOF
+ echo "::group::Workflow results"
+ python3 -m json.tool "$WORKFLOW_RESULT_FILE"
+ echo "::endgroup::"
+ python3 ./tests/ci/ci_buddy.py --check-wf-status
diff --git a/.github/workflows/merge_queue.yml b/.github/workflows/merge_queue.yml
index 31a65ac3d15..db89825a99a 100644
--- a/.github/workflows/merge_queue.yml
+++ b/.github/workflows/merge_queue.yml
@@ -93,7 +93,7 @@ jobs:
data: ${{ needs.RunConfig.outputs.data }}
CheckReadyForMerge:
- if: ${{ !cancelled() && needs.StyleCheck.result == 'success' }}
+ if: ${{ !cancelled() }}
# Test_2 or Test_3 must not have jobs required for Mergeable check
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Tests_1]
runs-on: [self-hosted, style-checker-aarch64]
@@ -101,6 +101,17 @@ jobs:
- name: Check out repository code
uses: ClickHouse/checkout@v1
- name: Check and set merge status
+ if: ${{ needs.StyleCheck.result == 'success' }}
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
python3 merge_pr.py --set-ci-status --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
+ - name: Check Workflow results
+ run: |
+ export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json"
+ cat >> "$WORKFLOW_RESULT_FILE" << 'EOF'
+ ${{ toJson(needs) }}
+ EOF
+ echo "::group::Workflow results"
+ python3 -m json.tool "$WORKFLOW_RESULT_FILE"
+ echo "::endgroup::"
+ python3 ./tests/ci/ci_buddy.py --check-wf-status
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
index bffe5b4c1bf..fd5b5eefcc4 100644
--- a/.github/workflows/nightly.yml
+++ b/.github/workflows/nightly.yml
@@ -44,3 +44,20 @@ jobs:
with:
data: "${{ needs.RunConfig.outputs.data }}"
set_latest: true
+ CheckWorkflow:
+ if: ${{ !cancelled() }}
+ needs: [RunConfig, BuildDockers]
+ runs-on: [self-hosted, style-checker-aarch64]
+ steps:
+ - name: Check out repository code
+ uses: ClickHouse/checkout@v1
+ - name: Check Workflow results
+ run: |
+ export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json"
+ cat >> "$WORKFLOW_RESULT_FILE" << 'EOF'
+ ${{ toJson(needs) }}
+ EOF
+ echo "::group::Workflow results"
+ python3 -m json.tool "$WORKFLOW_RESULT_FILE"
+ echo "::endgroup::"
+ python3 ./tests/ci/ci_buddy.py --check-wf-status
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
index 5124e4dba2c..9930cf6dde4 100644
--- a/.github/workflows/pull_request.yml
+++ b/.github/workflows/pull_request.yml
@@ -151,7 +151,7 @@ jobs:
data: ${{ needs.RunConfig.outputs.data }}
CheckReadyForMerge:
- if: ${{ !cancelled() && needs.StyleCheck.result == 'success' }}
+ if: ${{ !cancelled() }}
# Test_2 or Test_3 must not have jobs required for Mergeable check
needs: [RunConfig, BuildDockers, StyleCheck, FastTest, Builds_1, Builds_2, Builds_Report, Tests_1]
runs-on: [self-hosted, style-checker-aarch64]
@@ -161,9 +161,20 @@ jobs:
with:
filter: tree:0
- name: Check and set merge status
+ if: ${{ needs.StyleCheck.result == 'success' }}
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
python3 merge_pr.py --set-ci-status --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
+ - name: Check Workflow results
+ run: |
+ export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json"
+ cat >> "$WORKFLOW_RESULT_FILE" << 'EOF'
+ ${{ toJson(needs) }}
+ EOF
+ echo "::group::Workflow results"
+ python3 -m json.tool "$WORKFLOW_RESULT_FILE"
+ echo "::endgroup::"
+ python3 ./tests/ci/ci_buddy.py --check-wf-status
################################# Stage Final #################################
#
diff --git a/.github/workflows/release_branches.yml b/.github/workflows/release_branches.yml
index 6a18999d74e..50565112825 100644
--- a/.github/workflows/release_branches.yml
+++ b/.github/workflows/release_branches.yml
@@ -441,8 +441,9 @@ jobs:
runner_type: stress-tester
data: ${{ needs.RunConfig.outputs.data }}
FinishCheck:
- if: ${{ !failure() && !cancelled() }}
+ if: ${{ !cancelled() }}
needs:
+ - RunConfig
- DockerServerImage
- DockerKeeperImage
- Builds_Report
@@ -478,9 +479,20 @@ jobs:
with:
clear-repository: true
- name: Finish label
+ if: ${{ !failure() }}
run: |
cd "$GITHUB_WORKSPACE/tests/ci"
# update mergeable check
python3 merge_pr.py --set-ci-status --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
# update overall ci report
python3 finish_check.py --wf-status ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
+ - name: Check Workflow results
+ run: |
+ export WORKFLOW_RESULT_FILE="/tmp/workflow_results.json"
+ cat >> "$WORKFLOW_RESULT_FILE" << 'EOF'
+ ${{ toJson(needs) }}
+ EOF
+ echo "::group::Workflow results"
+ python3 -m json.tool "$WORKFLOW_RESULT_FILE"
+ echo "::endgroup::"
+ python3 ./tests/ci/ci_buddy.py --check-wf-status
diff --git a/.yamllint b/.yamllint
index f144e2d47b1..7fb741ec9f4 100644
--- a/.yamllint
+++ b/.yamllint
@@ -14,3 +14,9 @@ rules:
comments:
min-spaces-from-content: 1
document-start: disable
+ colons: disable
+ indentation: disable
+ line-length: disable
+ trailing-spaces: disable
+ truthy: disable
+ new-line-at-end-of-file: disable
diff --git a/base/base/defines.h b/base/base/defines.h
index 2fc54c37bde..5685a6d9833 100644
--- a/base/base/defines.h
+++ b/base/base/defines.h
@@ -87,10 +87,13 @@
# define ASAN_POISON_MEMORY_REGION(a, b)
#endif
-#if !defined(ABORT_ON_LOGICAL_ERROR)
- #if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || defined(MEMORY_SANITIZER) || defined(UNDEFINED_BEHAVIOR_SANITIZER)
- #define ABORT_ON_LOGICAL_ERROR
- #endif
+/// We used to have only ABORT_ON_LOGICAL_ERROR macro, but most of its uses were actually in places where we didn't care about logical errors
+/// but wanted to check exactly if the current build type is debug or with sanitizer. This new macro is introduced to fix those places.
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
+# if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER) || defined(MEMORY_SANITIZER) \
+ || defined(UNDEFINED_BEHAVIOR_SANITIZER)
+# define DEBUG_OR_SANITIZER_BUILD
+# endif
#endif
/// chassert(x) is similar to assert(x), but:
@@ -101,7 +104,7 @@
/// Also it makes sense to call abort() instead of __builtin_unreachable() in debug builds,
/// because SIGABRT is easier to debug than SIGTRAP (the second one makes gdb crazy)
#if !defined(chassert)
- #if defined(ABORT_ON_LOGICAL_ERROR)
+# if defined(DEBUG_OR_SANITIZER_BUILD)
// clang-format off
#include
namespace DB
diff --git a/docs/en/operations/settings/settings-users.md b/docs/en/operations/settings/settings-users.md
index 96477f777a9..ef1e58fd18e 100644
--- a/docs/en/operations/settings/settings-users.md
+++ b/docs/en/operations/settings/settings-users.md
@@ -22,6 +22,21 @@ Structure of the `users` section:
+
+
+ ssh-ed25519
+ AAAAC3NzaC1lZDI1NTE5AAAAIDNf0r6vRl24Ix3tv2IgPmNPO2ATa2krvt80DdcTatLj
+
+
+ ecdsa-sha2-nistp256
+ AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNxeV2uN5UY6CUbCzTA1rXfYimKQA5ivNIqxdax4bcMXz4D0nSk2l5E1TkR5mG8EBWtmExSPbcEPJ8V7lyWWbA8=
+
+
+ ssh-rsa
+ AAAAB3NzaC1yc2EAAAADAQABAAABgQCpgqL1SHhPVBOTFlOm0pu+cYBbADzC2jL41sPMawYCJHDyHuq7t+htaVVh2fRgpAPmSEnLEC2d4BEIKMtPK3bfR8plJqVXlLt6Q8t4b1oUlnjb3VPA9P6iGcW7CV1FBkZQEVx8ckOfJ3F+kI5VsrRlEDgiecm/C1VPl0/9M2llW/mPUMaD65cM9nlZgM/hUeBrfxOEqM11gDYxEZm1aRSbZoY4dfdm3vzvpSQ6lrCrkjn3X2aSmaCLcOWJhfBWMovNDB8uiPuw54g3ioZ++qEQMlfxVsqXDGYhXCrsArOVuW/5RbReO79BvXqdssiYShfwo+GhQ0+aLWMIW/jgBkkqx/n7uKLzCMX7b2F+aebRYFh+/QXEj7SnihdVfr9ud6NN3MWzZ1ltfIczlEcFLrLJ1Yq57wW6wXtviWh59WvTWFiPejGjeSjjJyqqB49tKdFVFuBnIU5u/bch2DXVgiAEdQwUrIp1ACoYPq22HFFAYUJrL32y7RxX3PGzuAv3LOc=
+
+
+
0|1
@@ -79,6 +94,24 @@ Password can be specified in plaintext or in SHA256 (hex format).
The first line of the result is the password. The second line is the corresponding double SHA1 hash.
+### username/ssh-key {#user-sshkey}
+
+This setting allows authenticating with SSH keys.
+
+Given a SSH key (as generated by `ssh-keygen`) like
+```
+ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDNf0r6vRl24Ix3tv2IgPmNPO2ATa2krvt80DdcTatLj john@example.com
+```
+The `ssh_key` element is expected to be
+```
+
+ ssh-ed25519
+ AAAAC3NzaC1lZDI1NTE5AAAAIDNf0r6vRl24Ix3tv2IgPmNPO2ATa2krvt80DdcTatLj
+
+```
+
+Substitute `ssh-ed25519` with `ssh-rsa` or `ecdsa-sha2-nistp256` for the other supported algorithms.
+
### access_management {#access_management-user-setting}
This setting enables or disables using of SQL-driven [access control and account management](../../guides/sre/user-management/index.md#access-control) for the user.
diff --git a/src/Analyzer/QueryTreePassManager.cpp b/src/Analyzer/QueryTreePassManager.cpp
index f7919b6422c..4443f83596f 100644
--- a/src/Analyzer/QueryTreePassManager.cpp
+++ b/src/Analyzer/QueryTreePassManager.cpp
@@ -62,7 +62,7 @@ namespace ErrorCodes
namespace
{
-#if defined(ABORT_ON_LOGICAL_ERROR)
+#if defined(DEBUG_OR_SANITIZER_BUILD)
/** This visitor checks if Query Tree structure is valid after each pass
* in debug build.
@@ -183,7 +183,7 @@ void QueryTreePassManager::run(QueryTreeNodePtr query_tree_node)
for (size_t i = 0; i < passes_size; ++i)
{
passes[i]->run(query_tree_node, current_context);
-#if defined(ABORT_ON_LOGICAL_ERROR)
+#if defined(DEBUG_OR_SANITIZER_BUILD)
ValidationChecker(passes[i]->getName()).visit(query_tree_node);
#endif
}
@@ -208,7 +208,7 @@ void QueryTreePassManager::run(QueryTreeNodePtr query_tree_node, size_t up_to_pa
for (size_t i = 0; i < up_to_pass_index; ++i)
{
passes[i]->run(query_tree_node, current_context);
-#if defined(ABORT_ON_LOGICAL_ERROR)
+#if defined(DEBUG_OR_SANITIZER_BUILD)
ValidationChecker(passes[i]->getName()).visit(query_tree_node);
#endif
}
diff --git a/src/Backups/BackupUtils.cpp b/src/Backups/BackupUtils.cpp
index fa8ed5855dd..cd3f963b15d 100644
--- a/src/Backups/BackupUtils.cpp
+++ b/src/Backups/BackupUtils.cpp
@@ -105,7 +105,7 @@ bool compareRestoredTableDef(const IAST & restored_table_create_query, const IAS
auto new_query = query.clone();
adjustCreateQueryForBackup(new_query, global_context);
ASTCreateQuery & create = typeid_cast(*new_query);
- create.setUUID({});
+ create.resetUUIDs();
create.if_not_exists = false;
return new_query;
};
diff --git a/src/Backups/RestoreCoordinationLocal.cpp b/src/Backups/RestoreCoordinationLocal.cpp
index f51d6c0c1d8..9fe22f874b4 100644
--- a/src/Backups/RestoreCoordinationLocal.cpp
+++ b/src/Backups/RestoreCoordinationLocal.cpp
@@ -1,4 +1,5 @@
#include
+#include
#include
#include
@@ -67,7 +68,7 @@ void RestoreCoordinationLocal::generateUUIDForTable(ASTCreateQuery & create_quer
auto it = create_query_uuids.find(query_str);
if (it != create_query_uuids.end())
{
- create_query.setUUID(it->second);
+ it->second.copyToQuery(create_query);
return true;
}
return false;
@@ -79,7 +80,8 @@ void RestoreCoordinationLocal::generateUUIDForTable(ASTCreateQuery & create_quer
return;
}
- auto new_uuids = create_query.generateRandomUUID(/* always_generate_new_uuid= */ true);
+ CreateQueryUUIDs new_uuids{create_query, /* generate_random= */ true, /* force_random= */ true};
+ new_uuids.copyToQuery(create_query);
{
std::lock_guard lock{mutex};
diff --git a/src/Backups/RestoreCoordinationLocal.h b/src/Backups/RestoreCoordinationLocal.h
index 5e51b719d63..35f93574b68 100644
--- a/src/Backups/RestoreCoordinationLocal.h
+++ b/src/Backups/RestoreCoordinationLocal.h
@@ -1,16 +1,17 @@
#pragma once
#include
-#include
+#include
+#include
#include
#include
#include
-namespace Poco { class Logger; }
-
namespace DB
{
+class ASTCreateQuery;
+
/// Implementation of the IRestoreCoordination interface performing coordination in memory.
class RestoreCoordinationLocal : public IRestoreCoordination
@@ -55,7 +56,7 @@ private:
std::set> acquired_tables_in_replicated_databases;
std::unordered_set acquired_data_in_replicated_tables;
- std::unordered_map create_query_uuids;
+ std::unordered_map create_query_uuids;
std::unordered_set acquired_data_in_keeper_map_tables;
mutable std::mutex mutex;
diff --git a/src/Backups/RestoreCoordinationRemote.cpp b/src/Backups/RestoreCoordinationRemote.cpp
index 84106737fc9..44214d00be5 100644
--- a/src/Backups/RestoreCoordinationRemote.cpp
+++ b/src/Backups/RestoreCoordinationRemote.cpp
@@ -3,6 +3,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -269,7 +270,8 @@ bool RestoreCoordinationRemote::acquireInsertingDataForKeeperMap(const String &
void RestoreCoordinationRemote::generateUUIDForTable(ASTCreateQuery & create_query)
{
String query_str = serializeAST(create_query);
- String new_uuids_str = create_query.generateRandomUUID(/* always_generate_new_uuid= */ true).toString();
+ CreateQueryUUIDs new_uuids{create_query, /* generate_random= */ true, /* force_random= */ true};
+ String new_uuids_str = new_uuids.toString();
auto holder = with_retries.createRetriesControlHolder("generateUUIDForTable");
holder.retries_ctl.retryLoop(
@@ -281,11 +283,14 @@ void RestoreCoordinationRemote::generateUUIDForTable(ASTCreateQuery & create_que
Coordination::Error res = zk->tryCreate(path, new_uuids_str, zkutil::CreateMode::Persistent);
if (res == Coordination::Error::ZOK)
+ {
+ new_uuids.copyToQuery(create_query);
return;
+ }
if (res == Coordination::Error::ZNODEEXISTS)
{
- create_query.setUUID(ASTCreateQuery::UUIDs::fromString(zk->get(path)));
+ CreateQueryUUIDs::fromString(zk->get(path)).copyToQuery(create_query);
return;
}
diff --git a/src/Columns/ColumnAggregateFunction.cpp b/src/Columns/ColumnAggregateFunction.cpp
index 33bd1266c90..e26fe790a8e 100644
--- a/src/Columns/ColumnAggregateFunction.cpp
+++ b/src/Columns/ColumnAggregateFunction.cpp
@@ -267,7 +267,7 @@ bool ColumnAggregateFunction::structureEquals(const IColumn & to) const
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnAggregateFunction::insertRangeFrom(const IColumn & from, size_t start, size_t length)
#else
void ColumnAggregateFunction::doInsertRangeFrom(const IColumn & from, size_t start, size_t length)
@@ -465,7 +465,7 @@ void ColumnAggregateFunction::insertFromWithOwnership(const IColumn & from, size
insertMergeFrom(from, n);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnAggregateFunction::insertFrom(const IColumn & from, size_t n)
#else
void ColumnAggregateFunction::doInsertFrom(const IColumn & from, size_t n)
diff --git a/src/Columns/ColumnAggregateFunction.h b/src/Columns/ColumnAggregateFunction.h
index 330a707b75c..b581c3ba3b4 100644
--- a/src/Columns/ColumnAggregateFunction.h
+++ b/src/Columns/ColumnAggregateFunction.h
@@ -145,7 +145,7 @@ public:
void insertData(const char * pos, size_t length) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & from, size_t n) override;
#else
using IColumn::insertFrom;
@@ -189,7 +189,7 @@ public:
void protect() override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & from, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & from, size_t start, size_t length) override;
@@ -212,7 +212,7 @@ public:
MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t, size_t, const IColumn &, int) const override
#else
int doCompareAt(size_t, size_t, const IColumn &, int) const override
diff --git a/src/Columns/ColumnArray.cpp b/src/Columns/ColumnArray.cpp
index 9203fb8042f..19cce678cc7 100644
--- a/src/Columns/ColumnArray.cpp
+++ b/src/Columns/ColumnArray.cpp
@@ -336,7 +336,7 @@ bool ColumnArray::tryInsert(const Field & x)
return true;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnArray::insertFrom(const IColumn & src_, size_t n)
#else
void ColumnArray::doInsertFrom(const IColumn & src_, size_t n)
@@ -395,7 +395,7 @@ int ColumnArray::compareAtImpl(size_t n, size_t m, const IColumn & rhs_, int nan
: 1);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnArray::compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const
#else
int ColumnArray::doCompareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const
@@ -542,7 +542,7 @@ void ColumnArray::getExtremes(Field & min, Field & max) const
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnArray::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnArray::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
diff --git a/src/Columns/ColumnArray.h b/src/Columns/ColumnArray.h
index 5e01b9144d7..63affb86d9d 100644
--- a/src/Columns/ColumnArray.h
+++ b/src/Columns/ColumnArray.h
@@ -84,14 +84,14 @@ public:
void updateHashWithValue(size_t n, SipHash & hash) const override;
WeakHash32 getWeakHash32() const override;
void updateHashFast(SipHash & hash) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#endif
void insert(const Field & x) override;
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src_, size_t n) override;
#else
void doInsertFrom(const IColumn & src_, size_t n) override;
@@ -103,7 +103,7 @@ public:
ColumnPtr permute(const Permutation & perm, size_t limit) const override;
ColumnPtr index(const IColumn & indexes, size_t limit) const override;
template ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override;
diff --git a/src/Columns/ColumnCompressed.h b/src/Columns/ColumnCompressed.h
index 19470113394..c4270e8216b 100644
--- a/src/Columns/ColumnCompressed.h
+++ b/src/Columns/ColumnCompressed.h
@@ -86,7 +86,7 @@ public:
bool isDefaultAt(size_t) const override { throwMustBeDecompressed(); }
void insert(const Field &) override { throwMustBeDecompressed(); }
bool tryInsert(const Field &) override { throwMustBeDecompressed(); }
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn &, size_t, size_t) override { throwMustBeDecompressed(); }
#else
void doInsertRangeFrom(const IColumn &, size_t, size_t) override { throwMustBeDecompressed(); }
@@ -105,7 +105,7 @@ public:
void expand(const Filter &, bool) override { throwMustBeDecompressed(); }
ColumnPtr permute(const Permutation &, size_t) const override { throwMustBeDecompressed(); }
ColumnPtr index(const IColumn &, size_t) const override { throwMustBeDecompressed(); }
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t, size_t, const IColumn &, int) const override { throwMustBeDecompressed(); }
#else
int doCompareAt(size_t, size_t, const IColumn &, int) const override { throwMustBeDecompressed(); }
diff --git a/src/Columns/ColumnConst.h b/src/Columns/ColumnConst.h
index 65ce53687b9..ca38e76ea57 100644
--- a/src/Columns/ColumnConst.h
+++ b/src/Columns/ColumnConst.h
@@ -123,7 +123,7 @@ public:
return data->isNullAt(0);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn &, size_t /*start*/, size_t length) override
#else
void doInsertRangeFrom(const IColumn &, size_t /*start*/, size_t length) override
@@ -151,7 +151,7 @@ public:
++s;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn &, size_t) override
#else
void doInsertFrom(const IColumn &, size_t) override
@@ -160,7 +160,7 @@ public:
++s;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertManyFrom(const IColumn & /*src*/, size_t /* position */, size_t length) override { s += length; }
#else
void doInsertManyFrom(const IColumn & /*src*/, size_t /* position */, size_t length) override { s += length; }
@@ -237,7 +237,7 @@ public:
return data->allocatedBytes() + sizeof(s);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t, size_t, const IColumn & rhs, int nan_direction_hint) const override
#else
int doCompareAt(size_t, size_t, const IColumn & rhs, int nan_direction_hint) const override
diff --git a/src/Columns/ColumnDecimal.cpp b/src/Columns/ColumnDecimal.cpp
index e27807950ae..bb4433f8956 100644
--- a/src/Columns/ColumnDecimal.cpp
+++ b/src/Columns/ColumnDecimal.cpp
@@ -31,7 +31,7 @@ namespace ErrorCodes
}
template
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnDecimal::compareAt(size_t n, size_t m, const IColumn & rhs_, int) const
#else
int ColumnDecimal::doCompareAt(size_t n, size_t m, const IColumn & rhs_, int) const
@@ -333,7 +333,7 @@ void ColumnDecimal::insertData(const char * src, size_t /*length*/)
}
template
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnDecimal::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnDecimal::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
diff --git a/src/Columns/ColumnDecimal.h b/src/Columns/ColumnDecimal.h
index eb8a305a822..59bfbd2159c 100644
--- a/src/Columns/ColumnDecimal.h
+++ b/src/Columns/ColumnDecimal.h
@@ -55,13 +55,13 @@ public:
void reserve(size_t n) override { data.reserve_exact(n); }
void shrinkToFit() override { data.shrink_to_fit(); }
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src, size_t n) override { data.push_back(static_cast(src).getData()[n]); }
#else
void doInsertFrom(const IColumn & src, size_t n) override { data.push_back(static_cast(src).getData()[n]); }
#endif
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertManyFrom(const IColumn & src, size_t position, size_t length) override
#else
void doInsertManyFrom(const IColumn & src, size_t position, size_t length) override
@@ -76,7 +76,7 @@ public:
void insertManyDefaults(size_t length) override { data.resize_fill(data.size() + length); }
void insert(const Field & x) override { data.push_back(x.get()); }
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
@@ -104,7 +104,7 @@ public:
void updateHashWithValue(size_t n, SipHash & hash) const override;
WeakHash32 getWeakHash32() const override;
void updateHashFast(SipHash & hash) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override;
diff --git a/src/Columns/ColumnDynamic.cpp b/src/Columns/ColumnDynamic.cpp
index c735238f515..a92d54dd675 100644
--- a/src/Columns/ColumnDynamic.cpp
+++ b/src/Columns/ColumnDynamic.cpp
@@ -215,7 +215,7 @@ bool ColumnDynamic::tryInsert(const DB::Field & x)
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnDynamic::insertFrom(const DB::IColumn & src_, size_t n)
#else
void ColumnDynamic::doInsertFrom(const DB::IColumn & src_, size_t n)
@@ -269,7 +269,7 @@ void ColumnDynamic::doInsertFrom(const DB::IColumn & src_, size_t n)
variant_col.insertIntoVariantFrom(string_variant_discr, *tmp_string_column, 0);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnDynamic::insertRangeFrom(const DB::IColumn & src_, size_t start, size_t length)
#else
void ColumnDynamic::doInsertRangeFrom(const DB::IColumn & src_, size_t start, size_t length)
@@ -439,7 +439,7 @@ void ColumnDynamic::doInsertRangeFrom(const DB::IColumn & src_, size_t start, si
}
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnDynamic::insertManyFrom(const DB::IColumn & src_, size_t position, size_t length)
#else
void ColumnDynamic::doInsertManyFrom(const DB::IColumn & src_, size_t position, size_t length)
@@ -603,7 +603,7 @@ void ColumnDynamic::updateHashWithValue(size_t n, SipHash & hash) const
variant_col.getVariantByGlobalDiscriminator(discr).updateHashWithValue(variant_col.offsetAt(n), hash);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnDynamic::compareAt(size_t n, size_t m, const DB::IColumn & rhs, int nan_direction_hint) const
#else
int ColumnDynamic::doCompareAt(size_t n, size_t m, const DB::IColumn & rhs, int nan_direction_hint) const
diff --git a/src/Columns/ColumnDynamic.h b/src/Columns/ColumnDynamic.h
index 6f09abb945a..e92cabd3db9 100644
--- a/src/Columns/ColumnDynamic.h
+++ b/src/Columns/ColumnDynamic.h
@@ -144,7 +144,7 @@ public:
void insert(const Field & x) override;
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src_, size_t n) override;
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
void insertManyFrom(const IColumn & src, size_t position, size_t length) override;
@@ -221,7 +221,7 @@ public:
return scattered_columns;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
diff --git a/src/Columns/ColumnFixedString.cpp b/src/Columns/ColumnFixedString.cpp
index 4d17eb0bebd..0bb3f7edb14 100644
--- a/src/Columns/ColumnFixedString.cpp
+++ b/src/Columns/ColumnFixedString.cpp
@@ -74,7 +74,7 @@ bool ColumnFixedString::tryInsert(const Field & x)
return true;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnFixedString::insertFrom(const IColumn & src_, size_t index)
#else
void ColumnFixedString::doInsertFrom(const IColumn & src_, size_t index)
@@ -90,7 +90,7 @@ void ColumnFixedString::doInsertFrom(const IColumn & src_, size_t index)
memcpySmallAllowReadWriteOverflow15(chars.data() + old_size, &src.chars[n * index], n);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnFixedString::insertManyFrom(const IColumn & src, size_t position, size_t length)
#else
void ColumnFixedString::doInsertManyFrom(const IColumn & src, size_t position, size_t length)
@@ -225,7 +225,7 @@ size_t ColumnFixedString::estimateCardinalityInPermutedRange(const Permutation &
return elements.size();
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnFixedString::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnFixedString::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
diff --git a/src/Columns/ColumnFixedString.h b/src/Columns/ColumnFixedString.h
index 630c6c1c0a6..676ac7712ba 100644
--- a/src/Columns/ColumnFixedString.h
+++ b/src/Columns/ColumnFixedString.h
@@ -98,13 +98,13 @@ public:
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src_, size_t index) override;
#else
void doInsertFrom(const IColumn & src_, size_t index) override;
#endif
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertManyFrom(const IColumn & src, size_t position, size_t length) override;
#else
void doInsertManyFrom(const IColumn & src, size_t position, size_t length) override;
@@ -137,7 +137,7 @@ public:
void updateHashFast(SipHash & hash) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t p1, size_t p2, const IColumn & rhs_, int /*nan_direction_hint*/) const override
#else
int doCompareAt(size_t p1, size_t p2, const IColumn & rhs_, int /*nan_direction_hint*/) const override
@@ -156,7 +156,7 @@ public:
size_t estimateCardinalityInPermutedRange(const Permutation & permutation, const EqualRange & equal_range) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
diff --git a/src/Columns/ColumnFunction.cpp b/src/Columns/ColumnFunction.cpp
index fa57f35a823..fc81efaac0c 100644
--- a/src/Columns/ColumnFunction.cpp
+++ b/src/Columns/ColumnFunction.cpp
@@ -72,7 +72,7 @@ ColumnPtr ColumnFunction::cut(size_t start, size_t length) const
return ColumnFunction::create(length, function, capture, is_short_circuit_argument, is_function_compiled);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnFunction::insertFrom(const IColumn & src, size_t n)
#else
void ColumnFunction::doInsertFrom(const IColumn & src, size_t n)
@@ -93,7 +93,7 @@ void ColumnFunction::doInsertFrom(const IColumn & src, size_t n)
++elements_size;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnFunction::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnFunction::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
diff --git a/src/Columns/ColumnFunction.h b/src/Columns/ColumnFunction.h
index dcd67aecad7..b62c6bf70eb 100644
--- a/src/Columns/ColumnFunction.h
+++ b/src/Columns/ColumnFunction.h
@@ -95,12 +95,12 @@ public:
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot insert into {}", getName());
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src, size_t n) override;
#else
void doInsertFrom(const IColumn & src, size_t n) override;
#endif
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn &, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn &, size_t start, size_t length) override;
@@ -146,7 +146,7 @@ public:
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "popBack is not implemented for {}", getName());
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t, size_t, const IColumn &, int) const override
#else
int doCompareAt(size_t, size_t, const IColumn &, int) const override
diff --git a/src/Columns/ColumnLowCardinality.cpp b/src/Columns/ColumnLowCardinality.cpp
index 49ce948bf78..a977046b07f 100644
--- a/src/Columns/ColumnLowCardinality.cpp
+++ b/src/Columns/ColumnLowCardinality.cpp
@@ -158,7 +158,7 @@ void ColumnLowCardinality::insertDefault()
idx.insertPosition(getDictionary().getDefaultValueIndex());
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnLowCardinality::insertFrom(const IColumn & src, size_t n)
#else
void ColumnLowCardinality::doInsertFrom(const IColumn & src, size_t n)
@@ -190,7 +190,7 @@ void ColumnLowCardinality::insertFromFullColumn(const IColumn & src, size_t n)
idx.insertPosition(getDictionary().uniqueInsertFrom(src, n));
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnLowCardinality::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnLowCardinality::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
@@ -362,7 +362,7 @@ int ColumnLowCardinality::compareAtImpl(size_t n, size_t m, const IColumn & rhs,
return getDictionary().compareAt(n_index, m_index, low_cardinality_column.getDictionary(), nan_direction_hint);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnLowCardinality::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
#else
int ColumnLowCardinality::doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
diff --git a/src/Columns/ColumnLowCardinality.h b/src/Columns/ColumnLowCardinality.h
index fb0c1237fcf..3766b247d60 100644
--- a/src/Columns/ColumnLowCardinality.h
+++ b/src/Columns/ColumnLowCardinality.h
@@ -78,14 +78,14 @@ public:
bool tryInsert(const Field & x) override;
void insertDefault() override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src, size_t n) override;
#else
void doInsertFrom(const IColumn & src, size_t n) override;
#endif
void insertFromFullColumn(const IColumn & src, size_t n);
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
@@ -135,7 +135,7 @@ public:
return ColumnLowCardinality::create(dictionary.getColumnUniquePtr(), getIndexes().index(indexes_, limit));
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
diff --git a/src/Columns/ColumnMap.cpp b/src/Columns/ColumnMap.cpp
index 08d7734ac6b..1025b4e77b9 100644
--- a/src/Columns/ColumnMap.cpp
+++ b/src/Columns/ColumnMap.cpp
@@ -153,7 +153,7 @@ void ColumnMap::updateHashFast(SipHash & hash) const
nested->updateHashFast(hash);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnMap::insertFrom(const IColumn & src, size_t n)
#else
void ColumnMap::doInsertFrom(const IColumn & src, size_t n)
@@ -162,7 +162,7 @@ void ColumnMap::doInsertFrom(const IColumn & src, size_t n)
nested->insertFrom(assert_cast(src).getNestedColumn(), n);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnMap::insertManyFrom(const IColumn & src, size_t position, size_t length)
#else
void ColumnMap::doInsertManyFrom(const IColumn & src, size_t position, size_t length)
@@ -171,7 +171,7 @@ void ColumnMap::doInsertManyFrom(const IColumn & src, size_t position, size_t le
assert_cast(*nested).insertManyFrom(assert_cast(src).getNestedColumn(), position, length);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnMap::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnMap::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
@@ -222,7 +222,7 @@ MutableColumns ColumnMap::scatter(ColumnIndex num_columns, const Selector & sele
return res;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnMap::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
#else
int ColumnMap::doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
diff --git a/src/Columns/ColumnMap.h b/src/Columns/ColumnMap.h
index 29275e1b5f7..3eaaa0ad562 100644
--- a/src/Columns/ColumnMap.h
+++ b/src/Columns/ColumnMap.h
@@ -67,7 +67,7 @@ public:
WeakHash32 getWeakHash32() const override;
void updateHashFast(SipHash & hash) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src_, size_t n) override;
void insertManyFrom(const IColumn & src, size_t position, size_t length) override;
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
@@ -83,7 +83,7 @@ public:
ColumnPtr index(const IColumn & indexes, size_t limit) const override;
ColumnPtr replicate(const Offsets & offsets) const override;
MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
diff --git a/src/Columns/ColumnNullable.cpp b/src/Columns/ColumnNullable.cpp
index 867c9149242..6529f0b78db 100644
--- a/src/Columns/ColumnNullable.cpp
+++ b/src/Columns/ColumnNullable.cpp
@@ -217,7 +217,7 @@ const char * ColumnNullable::skipSerializedInArena(const char * pos) const
return pos;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnNullable::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnNullable::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
@@ -258,7 +258,7 @@ bool ColumnNullable::tryInsert(const Field & x)
return true;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnNullable::insertFrom(const IColumn & src, size_t n)
#else
void ColumnNullable::doInsertFrom(const IColumn & src, size_t n)
@@ -270,7 +270,7 @@ void ColumnNullable::doInsertFrom(const IColumn & src, size_t n)
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnNullable::insertManyFrom(const IColumn & src, size_t position, size_t length)
#else
void ColumnNullable::doInsertManyFrom(const IColumn & src, size_t position, size_t length)
@@ -410,7 +410,7 @@ int ColumnNullable::compareAtImpl(size_t n, size_t m, const IColumn & rhs_, int
return getNestedColumn().compareAt(n, m, nested_rhs, null_direction_hint);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnNullable::compareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const
#else
int ColumnNullable::doCompareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const
diff --git a/src/Columns/ColumnNullable.h b/src/Columns/ColumnNullable.h
index 15bbd8c3b57..fe9f5b6dcc2 100644
--- a/src/Columns/ColumnNullable.h
+++ b/src/Columns/ColumnNullable.h
@@ -69,7 +69,7 @@ public:
char * serializeValueIntoMemory(size_t n, char * memory) const override;
const char * deserializeAndInsertFromArena(const char * pos) override;
const char * skipSerializedInArena(const char * pos) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
@@ -77,7 +77,7 @@ public:
void insert(const Field & x) override;
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src, size_t n) override;
void insertManyFrom(const IColumn & src, size_t position, size_t length) override;
#else
@@ -100,7 +100,7 @@ public:
void expand(const Filter & mask, bool inverted) override;
ColumnPtr permute(const Permutation & perm, size_t limit) const override;
ColumnPtr index(const IColumn & indexes, size_t limit) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const override;
diff --git a/src/Columns/ColumnObject.cpp b/src/Columns/ColumnObject.cpp
index 9c9dade3dd8..a6431007cb6 100644
--- a/src/Columns/ColumnObject.cpp
+++ b/src/Columns/ColumnObject.cpp
@@ -763,7 +763,7 @@ void ColumnObject::get(size_t n, Field & res) const
}
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnObject::insertFrom(const IColumn & src, size_t n)
#else
void ColumnObject::doInsertFrom(const IColumn & src, size_t n)
@@ -772,7 +772,7 @@ void ColumnObject::doInsertFrom(const IColumn & src, size_t n)
insert(src[n]);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnObject::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnObject::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
diff --git a/src/Columns/ColumnObject.h b/src/Columns/ColumnObject.h
index 5303adf0881..25cfaa550f6 100644
--- a/src/Columns/ColumnObject.h
+++ b/src/Columns/ColumnObject.h
@@ -211,7 +211,7 @@ public:
bool tryInsert(const Field & field) override;
void insertDefault() override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src, size_t n) override;
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
@@ -236,7 +236,7 @@ public:
/// Order of rows in ColumnObject is undefined.
void getPermutation(PermutationSortDirection, PermutationSortStability, size_t, int, Permutation & res) const override;
void updatePermutation(PermutationSortDirection, PermutationSortStability, size_t, int, Permutation &, EqualRanges &) const override {}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t, size_t, const IColumn &, int) const override { return 0; }
#else
int doCompareAt(size_t, size_t, const IColumn &, int) const override { return 0; }
diff --git a/src/Columns/ColumnSparse.cpp b/src/Columns/ColumnSparse.cpp
index 8f98a4433d3..a908d970a15 100644
--- a/src/Columns/ColumnSparse.cpp
+++ b/src/Columns/ColumnSparse.cpp
@@ -174,7 +174,7 @@ const char * ColumnSparse::skipSerializedInArena(const char * pos) const
return values->skipSerializedInArena(pos);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnSparse::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnSparse::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
@@ -252,7 +252,7 @@ bool ColumnSparse::tryInsert(const Field & x)
return true;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnSparse::insertFrom(const IColumn & src, size_t n)
#else
void ColumnSparse::doInsertFrom(const IColumn & src, size_t n)
@@ -454,7 +454,7 @@ ColumnPtr ColumnSparse::indexImpl(const PaddedPODArray & indexes, size_t l
return ColumnSparse::create(std::move(res_values), std::move(res_offsets), limit);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnSparse::compareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const
#else
int ColumnSparse::doCompareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const
diff --git a/src/Columns/ColumnSparse.h b/src/Columns/ColumnSparse.h
index 392a6910956..7a4d914e62a 100644
--- a/src/Columns/ColumnSparse.h
+++ b/src/Columns/ColumnSparse.h
@@ -81,14 +81,14 @@ public:
char * serializeValueIntoMemory(size_t n, char * memory) const override;
const char * deserializeAndInsertFromArena(const char * pos) override;
const char * skipSerializedInArena(const char *) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#endif
void insert(const Field & x) override;
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src, size_t n) override;
#else
void doInsertFrom(const IColumn & src, size_t n) override;
@@ -106,7 +106,7 @@ public:
template
ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs_, int null_direction_hint) const override;
diff --git a/src/Columns/ColumnString.cpp b/src/Columns/ColumnString.cpp
index 4accfbe8f41..7cfa2571f5a 100644
--- a/src/Columns/ColumnString.cpp
+++ b/src/Columns/ColumnString.cpp
@@ -39,7 +39,7 @@ ColumnString::ColumnString(const ColumnString & src)
last_offset, chars.size());
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnString::insertManyFrom(const IColumn & src, size_t position, size_t length)
#else
void ColumnString::doInsertManyFrom(const IColumn & src, size_t position, size_t length)
@@ -132,7 +132,7 @@ WeakHash32 ColumnString::getWeakHash32() const
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnString::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnString::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
diff --git a/src/Columns/ColumnString.h b/src/Columns/ColumnString.h
index faaaa8848ca..c1012e1e55e 100644
--- a/src/Columns/ColumnString.h
+++ b/src/Columns/ColumnString.h
@@ -142,7 +142,7 @@ public:
return true;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src_, size_t n) override
#else
void doInsertFrom(const IColumn & src_, size_t n) override
@@ -169,7 +169,7 @@ public:
}
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertManyFrom(const IColumn & src, size_t position, size_t length) override;
#else
void doInsertManyFrom(const IColumn & src, size_t position, size_t length) override;
@@ -220,7 +220,7 @@ public:
hash.update(reinterpret_cast(chars.data()), chars.size() * sizeof(chars[0]));
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
@@ -250,7 +250,7 @@ public:
offsets.push_back(offsets.back() + 1);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs_, int /*nan_direction_hint*/) const override
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs_, int /*nan_direction_hint*/) const override
diff --git a/src/Columns/ColumnTuple.cpp b/src/Columns/ColumnTuple.cpp
index 6a0d85cba69..4fc3f88a87c 100644
--- a/src/Columns/ColumnTuple.cpp
+++ b/src/Columns/ColumnTuple.cpp
@@ -206,7 +206,7 @@ bool ColumnTuple::tryInsert(const Field & x)
return true;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnTuple::insertFrom(const IColumn & src_, size_t n)
#else
void ColumnTuple::doInsertFrom(const IColumn & src_, size_t n)
@@ -223,7 +223,7 @@ void ColumnTuple::doInsertFrom(const IColumn & src_, size_t n)
columns[i]->insertFrom(*src.columns[i], n);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnTuple::insertManyFrom(const IColumn & src, size_t position, size_t length)
#else
void ColumnTuple::doInsertManyFrom(const IColumn & src, size_t position, size_t length)
@@ -327,7 +327,7 @@ void ColumnTuple::updateHashFast(SipHash & hash) const
column->updateHashFast(hash);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnTuple::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnTuple::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
@@ -483,7 +483,7 @@ int ColumnTuple::compareAtImpl(size_t n, size_t m, const IColumn & rhs, int nan_
return 0;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnTuple::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
#else
int ColumnTuple::doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
diff --git a/src/Columns/ColumnTuple.h b/src/Columns/ColumnTuple.h
index 2fafd93f776..16b47a993f6 100644
--- a/src/Columns/ColumnTuple.h
+++ b/src/Columns/ColumnTuple.h
@@ -66,7 +66,7 @@ public:
void insert(const Field & x) override;
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src_, size_t n) override;
void insertManyFrom(const IColumn & src, size_t position, size_t length) override;
#else
@@ -83,7 +83,7 @@ public:
void updateHashWithValue(size_t n, SipHash & hash) const override;
WeakHash32 getWeakHash32() const override;
void updateHashFast(SipHash & hash) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
@@ -94,7 +94,7 @@ public:
ColumnPtr index(const IColumn & indexes, size_t limit) const override;
ColumnPtr replicate(const Offsets & offsets) const override;
MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
diff --git a/src/Columns/ColumnUnique.h b/src/Columns/ColumnUnique.h
index ec1f8e0a4d5..d6cb75679be 100644
--- a/src/Columns/ColumnUnique.h
+++ b/src/Columns/ColumnUnique.h
@@ -90,7 +90,7 @@ public:
return getNestedColumn()->updateHashWithValue(n, hash_func);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
@@ -492,7 +492,7 @@ const char * ColumnUnique::skipSerializedInArena(const char *) const
}
template
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnUnique::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
#else
int ColumnUnique::doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
diff --git a/src/Columns/ColumnVariant.cpp b/src/Columns/ColumnVariant.cpp
index 8fd6e1bbac1..de7efb41d19 100644
--- a/src/Columns/ColumnVariant.cpp
+++ b/src/Columns/ColumnVariant.cpp
@@ -595,7 +595,7 @@ void ColumnVariant::insertManyFromImpl(const DB::IColumn & src_, size_t position
}
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnVariant::insertFrom(const IColumn & src_, size_t n)
#else
void ColumnVariant::doInsertFrom(const IColumn & src_, size_t n)
@@ -604,7 +604,7 @@ void ColumnVariant::doInsertFrom(const IColumn & src_, size_t n)
insertFromImpl(src_, n, nullptr);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnVariant::insertRangeFrom(const IColumn & src_, size_t start, size_t length)
#else
void ColumnVariant::doInsertRangeFrom(const IColumn & src_, size_t start, size_t length)
@@ -613,7 +613,7 @@ void ColumnVariant::doInsertRangeFrom(const IColumn & src_, size_t start, size_t
insertRangeFromImpl(src_, start, length, nullptr);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnVariant::insertManyFrom(const DB::IColumn & src_, size_t position, size_t length)
#else
void ColumnVariant::doInsertManyFrom(const DB::IColumn & src_, size_t position, size_t length)
@@ -1175,7 +1175,7 @@ bool ColumnVariant::hasEqualValues() const
return local_discriminators->hasEqualValues() && variants[localDiscriminatorAt(0)]->hasEqualValues();
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int ColumnVariant::compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
#else
int ColumnVariant::doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
diff --git a/src/Columns/ColumnVariant.h b/src/Columns/ColumnVariant.h
index 94f3066e676..34c24b5428d 100644
--- a/src/Columns/ColumnVariant.h
+++ b/src/Columns/ColumnVariant.h
@@ -180,7 +180,7 @@ public:
void insert(const Field & x) override;
bool tryInsert(const Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src_, size_t n) override;
void insertRangeFrom(const IColumn & src_, size_t start, size_t length) override;
void insertManyFrom(const IColumn & src_, size_t position, size_t length) override;
@@ -223,7 +223,7 @@ public:
ColumnPtr indexImpl(const PaddedPODArray & indexes, size_t limit) const;
ColumnPtr replicate(const Offsets & replicate_offsets) const override;
MutableColumns scatter(ColumnIndex num_columns, const Selector & selector) const override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const override;
diff --git a/src/Columns/ColumnVector.cpp b/src/Columns/ColumnVector.cpp
index 185a1e0f615..c474efe35bd 100644
--- a/src/Columns/ColumnVector.cpp
+++ b/src/Columns/ColumnVector.cpp
@@ -502,7 +502,7 @@ bool ColumnVector::tryInsert(const DB::Field & x)
}
template
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void ColumnVector::insertRangeFrom(const IColumn & src, size_t start, size_t length)
#else
void ColumnVector::doInsertRangeFrom(const IColumn & src, size_t start, size_t length)
diff --git a/src/Columns/ColumnVector.h b/src/Columns/ColumnVector.h
index c01778ecf32..2fe5b635bd2 100644
--- a/src/Columns/ColumnVector.h
+++ b/src/Columns/ColumnVector.h
@@ -64,7 +64,7 @@ public:
return data.size();
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn & src, size_t n) override
#else
void doInsertFrom(const IColumn & src, size_t n) override
@@ -73,7 +73,7 @@ public:
data.push_back(assert_cast(src).getData()[n]);
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertManyFrom(const IColumn & src, size_t position, size_t length) override
#else
void doInsertManyFrom(const IColumn & src, size_t position, size_t length) override
@@ -150,7 +150,7 @@ public:
}
/// This method implemented in header because it could be possibly devirtualized.
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override
#else
int doCompareAt(size_t n, size_t m, const IColumn & rhs_, int nan_direction_hint) const override
@@ -240,7 +240,7 @@ public:
bool tryInsert(const DB::Field & x) override;
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & src, size_t start, size_t length) override;
#else
void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) override;
diff --git a/src/Columns/IColumn.cpp b/src/Columns/IColumn.cpp
index 552e52cf51c..a189903b617 100644
--- a/src/Columns/IColumn.cpp
+++ b/src/Columns/IColumn.cpp
@@ -46,7 +46,7 @@ String IColumn::dumpStructure() const
return res.str();
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void IColumn::insertFrom(const IColumn & src, size_t n)
#else
void IColumn::doInsertFrom(const IColumn & src, size_t n)
diff --git a/src/Columns/IColumn.h b/src/Columns/IColumn.h
index 3798d3b7466..f9c1a3e7034 100644
--- a/src/Columns/IColumn.h
+++ b/src/Columns/IColumn.h
@@ -179,7 +179,7 @@ public:
/// Appends n-th element from other column with the same type.
/// Is used in merge-sort and merges. It could be implemented in inherited classes more optimally than default implementation.
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
virtual void insertFrom(const IColumn & src, size_t n);
#else
void insertFrom(const IColumn & src, size_t n)
@@ -191,7 +191,7 @@ public:
/// Appends range of elements from other column with the same type.
/// Could be used to concatenate columns.
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
virtual void insertRangeFrom(const IColumn & src, size_t start, size_t length) = 0;
#else
void insertRangeFrom(const IColumn & src, size_t start, size_t length)
@@ -202,7 +202,7 @@ public:
#endif
/// Appends one element from other column with the same type multiple times.
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
virtual void insertManyFrom(const IColumn & src, size_t position, size_t length)
{
for (size_t i = 0; i < length; ++i)
@@ -345,7 +345,7 @@ public:
*
* For non Nullable and non floating point types, nan_direction_hint is ignored.
*/
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
[[nodiscard]] virtual int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const = 0;
#else
[[nodiscard]] int compareAt(size_t n, size_t m, const IColumn & rhs, int nan_direction_hint) const
@@ -667,7 +667,7 @@ protected:
Sort full_sort,
PartialSort partial_sort) const;
-#if defined(ABORT_ON_LOGICAL_ERROR)
+#if defined(DEBUG_OR_SANITIZER_BUILD)
virtual void doInsertFrom(const IColumn & src, size_t n);
virtual void doInsertRangeFrom(const IColumn & src, size_t start, size_t length) = 0;
diff --git a/src/Columns/IColumnDummy.h b/src/Columns/IColumnDummy.h
index b18f4fdb302..40d410e207d 100644
--- a/src/Columns/IColumnDummy.h
+++ b/src/Columns/IColumnDummy.h
@@ -27,7 +27,7 @@ public:
size_t byteSize() const override { return 0; }
size_t byteSizeAt(size_t) const override { return 0; }
size_t allocatedBytes() const override { return 0; }
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
int compareAt(size_t, size_t, const IColumn &, int) const override { return 0; }
#else
int doCompareAt(size_t, size_t, const IColumn &, int) const override { return 0; }
@@ -73,7 +73,7 @@ public:
{
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertFrom(const IColumn &, size_t) override
#else
void doInsertFrom(const IColumn &, size_t) override
@@ -82,7 +82,7 @@ public:
++s;
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn & /*src*/, size_t /*start*/, size_t length) override
#else
void doInsertRangeFrom(const IColumn & /*src*/, size_t /*start*/, size_t length) override
diff --git a/src/Columns/IColumnUnique.h b/src/Columns/IColumnUnique.h
index 1b86204f5b1..a8e10e5e2b2 100644
--- a/src/Columns/IColumnUnique.h
+++ b/src/Columns/IColumnUnique.h
@@ -86,7 +86,7 @@ public:
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method tryInsert is not supported for ColumnUnique.");
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
void insertRangeFrom(const IColumn &, size_t, size_t) override
#else
void doInsertRangeFrom(const IColumn &, size_t, size_t) override
diff --git a/src/Columns/benchmarks/benchmark_column_insert_many_from.cpp b/src/Columns/benchmarks/benchmark_column_insert_many_from.cpp
index 645f6ed79f3..240099f0ae5 100644
--- a/src/Columns/benchmarks/benchmark_column_insert_many_from.cpp
+++ b/src/Columns/benchmarks/benchmark_column_insert_many_from.cpp
@@ -52,7 +52,7 @@ static ColumnPtr mockColumn(const DataTypePtr & type, size_t rows)
}
-#if !defined(ABORT_ON_LOGICAL_ERROR)
+#if !defined(DEBUG_OR_SANITIZER_BUILD)
static NO_INLINE void insertManyFrom(IColumn & dst, const IColumn & src)
#else
static NO_INLINE void doInsertManyFrom(IColumn & dst, const IColumn & src)
diff --git a/src/Common/Config/AbstractConfigurationComparison.cpp b/src/Common/Config/AbstractConfigurationComparison.cpp
index 607b583cf31..80c837ed43b 100644
--- a/src/Common/Config/AbstractConfigurationComparison.cpp
+++ b/src/Common/Config/AbstractConfigurationComparison.cpp
@@ -38,7 +38,7 @@ namespace
std::erase_if(left_subkeys, [&](const String & key) { return ignore_keys->contains(key); });
std::erase_if(right_subkeys, [&](const String & key) { return ignore_keys->contains(key); });
-#if defined(ABORT_ON_LOGICAL_ERROR)
+#if defined(DEBUG_OR_SANITIZER_BUILD)
/// Compound `ignore_keys` are not yet implemented.
for (const auto & ignore_key : *ignore_keys)
chassert(ignore_key.find('.') == std::string_view::npos);
diff --git a/src/Common/CurrentMetrics.cpp b/src/Common/CurrentMetrics.cpp
index 7c97e73f278..1011ab12d15 100644
--- a/src/Common/CurrentMetrics.cpp
+++ b/src/Common/CurrentMetrics.cpp
@@ -234,10 +234,10 @@
M(PartsCommitted, "Deprecated. See PartsActive.") \
M(PartsPreActive, "The part is in data_parts, but not used for SELECTs.") \
M(PartsActive, "Active data part, used by current and upcoming SELECTs.") \
- M(AttachedDatabase, "Active database, used by current and upcoming SELECTs.") \
- M(AttachedTable, "Active table, used by current and upcoming SELECTs.") \
- M(AttachedView, "Active view, used by current and upcoming SELECTs.") \
- M(AttachedDictionary, "Active dictionary, used by current and upcoming SELECTs.") \
+ M(AttachedDatabase, "Active databases.") \
+ M(AttachedTable, "Active tables.") \
+ M(AttachedView, "Active views.") \
+ M(AttachedDictionary, "Active dictionaries.") \
M(PartsOutdated, "Not active data part, but could be used by only current SELECTs, could be deleted after SELECTs finishes.") \
M(PartsDeleting, "Not active data part with identity refcounter, it is deleting right now by a cleaner.") \
M(PartsDeleteOnDestroy, "Part was moved to another disk and should be deleted in own destructor.") \
diff --git a/src/Common/Exception.cpp b/src/Common/Exception.cpp
index 111280074dd..33befa64946 100644
--- a/src/Common/Exception.cpp
+++ b/src/Common/Exception.cpp
@@ -64,7 +64,7 @@ void handle_error_code(const std::string & msg, int code, bool remote, const Exc
{
// In debug builds and builds with sanitizers, treat LOGICAL_ERROR as an assertion failure.
// Log the message before we fail.
-#ifdef ABORT_ON_LOGICAL_ERROR
+#ifdef DEBUG_OR_SANITIZER_BUILD
if (code == ErrorCodes::LOGICAL_ERROR)
{
abortOnFailedAssertion(msg, trace.data(), 0, trace.size());
@@ -443,7 +443,7 @@ PreformattedMessage getCurrentExceptionMessageAndPattern(bool with_stacktrace, b
}
catch (...) {} // NOLINT(bugprone-empty-catch)
-#ifdef ABORT_ON_LOGICAL_ERROR
+#ifdef DEBUG_OR_SANITIZER_BUILD
try
{
throw;
diff --git a/src/Common/MemoryTracker.cpp b/src/Common/MemoryTracker.cpp
index 28cfa98666a..ac412684cf7 100644
--- a/src/Common/MemoryTracker.cpp
+++ b/src/Common/MemoryTracker.cpp
@@ -192,7 +192,7 @@ void MemoryTracker::debugLogBigAllocationWithoutCheck(Int64 size [[maybe_unused]
{
/// Big allocations through allocNoThrow (without checking memory limits) may easily lead to OOM (and it's hard to debug).
/// Let's find them.
-#ifdef ABORT_ON_LOGICAL_ERROR
+#ifdef DEBUG_OR_SANITIZER_BUILD
if (size < 0)
return;
diff --git a/src/Common/PageCache.cpp b/src/Common/PageCache.cpp
index 56bd8c1a339..d719a387e14 100644
--- a/src/Common/PageCache.cpp
+++ b/src/Common/PageCache.cpp
@@ -424,7 +424,7 @@ static void logUnexpectedSyscallError(std::string name)
{
std::string message = fmt::format("{} failed: {}", name, errnoToString());
LOG_WARNING(&Poco::Logger::get("PageCache"), "{}", message);
-#if defined(ABORT_ON_LOGICAL_ERROR)
+#if defined(DEBUG_OR_SANITIZER_BUILD)
volatile bool true_ = true;
if (true_) // suppress warning about missing [[noreturn]]
abortOnFailedAssertion(message);
diff --git a/src/Common/assert_cast.h b/src/Common/assert_cast.h
index f9d0bf0e595..7a04372ffad 100644
--- a/src/Common/assert_cast.h
+++ b/src/Common/assert_cast.h
@@ -25,7 +25,7 @@ namespace DB
template
inline To assert_cast(From && from)
{
-#ifdef ABORT_ON_LOGICAL_ERROR
+#ifdef DEBUG_OR_SANITIZER_BUILD
try
{
if constexpr (std::is_pointer_v)
diff --git a/src/Common/tests/gtest_rw_lock.cpp b/src/Common/tests/gtest_rw_lock.cpp
index d8c6e9cb99d..9b0c9aeafbe 100644
--- a/src/Common/tests/gtest_rw_lock.cpp
+++ b/src/Common/tests/gtest_rw_lock.cpp
@@ -166,7 +166,7 @@ TEST(Common, RWLockRecursive)
auto lock2 = fifo_lock->getLock(RWLockImpl::Read, "q2");
-#ifndef ABORT_ON_LOGICAL_ERROR
+#ifndef DEBUG_OR_SANITIZER_BUILD
/// It throws LOGICAL_ERROR
EXPECT_ANY_THROW({fifo_lock->getLock(RWLockImpl::Write, "q2");});
#endif
diff --git a/src/Databases/DDLDependencyVisitor.cpp b/src/Databases/DDLDependencyVisitor.cpp
index d81dc7a76d8..d149b49d465 100644
--- a/src/Databases/DDLDependencyVisitor.cpp
+++ b/src/Databases/DDLDependencyVisitor.cpp
@@ -80,13 +80,20 @@ namespace
/// CREATE TABLE or CREATE DICTIONARY or CREATE VIEW or CREATE TEMPORARY TABLE or CREATE DATABASE query.
void visitCreateQuery(const ASTCreateQuery & create)
{
- QualifiedTableName to_table{create.to_table_id.database_name, create.to_table_id.table_name};
- if (!to_table.table.empty())
+ if (create.targets)
{
- /// TO target_table (for materialized views)
- if (to_table.database.empty())
- to_table.database = current_database;
- dependencies.emplace(to_table);
+ for (const auto & target : create.targets->targets)
+ {
+ const auto & table_id = target.table_id;
+ if (!table_id.table_name.empty())
+ {
+ /// TO target_table (for materialized views)
+ QualifiedTableName target_name{table_id.database_name, table_id.table_name};
+ if (target_name.database.empty())
+ target_name.database = current_database;
+ dependencies.emplace(target_name);
+ }
+ }
}
QualifiedTableName as_table{create.as_database, create.as_table};
diff --git a/src/Databases/DDLRenamingVisitor.cpp b/src/Databases/DDLRenamingVisitor.cpp
index 6cd414635a0..38e100e2470 100644
--- a/src/Databases/DDLRenamingVisitor.cpp
+++ b/src/Databases/DDLRenamingVisitor.cpp
@@ -86,12 +86,19 @@ namespace
create.as_table = as_table_new.table;
}
- QualifiedTableName to_table{create.to_table_id.database_name, create.to_table_id.table_name};
- if (!to_table.table.empty() && !to_table.database.empty())
+ if (create.targets)
{
- auto to_table_new = data.renaming_map.getNewTableName(to_table);
- if (to_table_new != to_table)
- create.to_table_id = StorageID{to_table_new.database, to_table_new.table};
+ for (auto & target : create.targets->targets)
+ {
+ auto & table_id = target.table_id;
+ if (!table_id.database_name.empty() && !table_id.table_name.empty())
+ {
+ QualifiedTableName target_name{table_id.database_name, table_id.table_name};
+ auto new_target_name = data.renaming_map.getNewTableName(target_name);
+ if (new_target_name != target_name)
+ table_id = StorageID{new_target_name.database, new_target_name.table};
+ }
+ }
}
}
diff --git a/src/Databases/DatabaseLazy.cpp b/src/Databases/DatabaseLazy.cpp
index 5017c9b25cb..ca30ee6db15 100644
--- a/src/Databases/DatabaseLazy.cpp
+++ b/src/Databases/DatabaseLazy.cpp
@@ -195,7 +195,7 @@ void DatabaseLazy::attachTable(ContextPtr /* context_ */, const String & table_n
snapshot_detached_tables.erase(table_name);
}
- CurrentMetrics::add(CurrentMetrics::AttachedTable, 1);
+ CurrentMetrics::add(CurrentMetrics::AttachedTable);
}
StoragePtr DatabaseLazy::detachTable(ContextPtr /* context */, const String & table_name)
@@ -221,7 +221,7 @@ StoragePtr DatabaseLazy::detachTable(ContextPtr /* context */, const String & ta
.metadata_path = getObjectMetadataPath(table_name),
.is_permanently = false});
- CurrentMetrics::sub(CurrentMetrics::AttachedTable, 1);
+ CurrentMetrics::sub(CurrentMetrics::AttachedTable);
}
return res;
}
diff --git a/src/Databases/DatabaseReplicated.cpp b/src/Databases/DatabaseReplicated.cpp
index 7ce2859e962..4c079ae5300 100644
--- a/src/Databases/DatabaseReplicated.cpp
+++ b/src/Databases/DatabaseReplicated.cpp
@@ -729,81 +729,14 @@ void DatabaseReplicated::checkQueryValid(const ASTPtr & query, ContextPtr query_
if (auto * create = query->as())
{
- bool replicated_table = create->storage && create->storage->engine &&
- (startsWith(create->storage->engine->name, "Replicated") || startsWith(create->storage->engine->name, "Shared"));
- if (!replicated_table || !create->storage->engine->arguments)
- return;
+ if (create->storage)
+ checkTableEngine(*create, *create->storage, query_context);
- ASTs & args_ref = create->storage->engine->arguments->children;
- ASTs args = args_ref;
- if (args.size() < 2)
- return;
-
- /// It can be a constant expression. Try to evaluate it, ignore exception if we cannot.
- bool has_expression_argument = args_ref[0]->as() || args_ref[1]->as();
- if (has_expression_argument)
+ if (create->targets)
{
- try
- {
- args[0] = evaluateConstantExpressionAsLiteral(args_ref[0]->clone(), query_context);
- args[1] = evaluateConstantExpressionAsLiteral(args_ref[1]->clone(), query_context);
- }
- catch (...) // NOLINT(bugprone-empty-catch)
- {
- }
+ for (const auto & inner_table_engine : create->targets->getInnerEngines())
+ checkTableEngine(*create, *inner_table_engine, query_context);
}
-
- ASTLiteral * arg1 = args[0]->as();
- ASTLiteral * arg2 = args[1]->as();
- if (!arg1 || !arg2 || arg1->value.getType() != Field::Types::String || arg2->value.getType() != Field::Types::String)
- return;
-
- String maybe_path = arg1->value.get();
- String maybe_replica = arg2->value.get();
-
- /// Looks like it's ReplicatedMergeTree with explicit zookeeper_path and replica_name arguments.
- /// Let's ensure that some macros are used.
- /// NOTE: we cannot check here that substituted values will be actually different on shards and replicas.
-
- Macros::MacroExpansionInfo info;
- info.table_id = {getDatabaseName(), create->getTable(), create->uuid};
- info.shard = getShardName();
- info.replica = getReplicaName();
- query_context->getMacros()->expand(maybe_path, info);
- bool maybe_shard_macros = info.expanded_other;
- info.expanded_other = false;
- query_context->getMacros()->expand(maybe_replica, info);
- bool maybe_replica_macros = info.expanded_other;
- bool enable_functional_tests_helper = getContext()->getConfigRef().has("_functional_tests_helper_database_replicated_replace_args_macros");
-
- if (!enable_functional_tests_helper)
- {
- if (query_context->getSettingsRef().database_replicated_allow_replicated_engine_arguments)
- LOG_WARNING(log, "It's not recommended to explicitly specify zookeeper_path and replica_name in ReplicatedMergeTree arguments");
- else
- throw Exception(ErrorCodes::INCORRECT_QUERY,
- "It's not allowed to specify explicit zookeeper_path and replica_name "
- "for ReplicatedMergeTree arguments in Replicated database. If you really want to "
- "specify them explicitly, enable setting "
- "database_replicated_allow_replicated_engine_arguments.");
- }
-
- if (maybe_shard_macros && maybe_replica_macros)
- return;
-
- if (enable_functional_tests_helper && !has_expression_argument)
- {
- if (maybe_path.empty() || maybe_path.back() != '/')
- maybe_path += '/';
- args_ref[0]->as()->value = maybe_path + "auto_{shard}";
- args_ref[1]->as()->value = maybe_replica + "auto_{replica}";
- return;
- }
-
- throw Exception(ErrorCodes::INCORRECT_QUERY,
- "Explicit zookeeper_path and replica_name are specified in ReplicatedMergeTree arguments. "
- "If you really want to specify it explicitly, then you should use some macros "
- "to distinguish different shards and replicas");
}
}
@@ -827,6 +760,85 @@ void DatabaseReplicated::checkQueryValid(const ASTPtr & query, ContextPtr query_
}
}
+void DatabaseReplicated::checkTableEngine(const ASTCreateQuery & query, ASTStorage & storage, ContextPtr query_context) const
+{
+ bool replicated_table = storage.engine &&
+ (startsWith(storage.engine->name, "Replicated") || startsWith(storage.engine->name, "Shared"));
+ if (!replicated_table || !storage.engine->arguments)
+ return;
+
+ ASTs & args_ref = storage.engine->arguments->children;
+ ASTs args = args_ref;
+ if (args.size() < 2)
+ return;
+
+ /// It can be a constant expression. Try to evaluate it, ignore exception if we cannot.
+ bool has_expression_argument = args_ref[0]->as() || args_ref[1]->as();
+ if (has_expression_argument)
+ {
+ try
+ {
+ args[0] = evaluateConstantExpressionAsLiteral(args_ref[0]->clone(), query_context);
+ args[1] = evaluateConstantExpressionAsLiteral(args_ref[1]->clone(), query_context);
+ }
+ catch (...) // NOLINT(bugprone-empty-catch)
+ {
+ }
+ }
+
+ ASTLiteral * arg1 = args[0]->as();
+ ASTLiteral * arg2 = args[1]->as();
+ if (!arg1 || !arg2 || arg1->value.getType() != Field::Types::String || arg2->value.getType() != Field::Types::String)
+ return;
+
+ String maybe_path = arg1->value.get();
+ String maybe_replica = arg2->value.get();
+
+ /// Looks like it's ReplicatedMergeTree with explicit zookeeper_path and replica_name arguments.
+ /// Let's ensure that some macros are used.
+ /// NOTE: we cannot check here that substituted values will be actually different on shards and replicas.
+
+ Macros::MacroExpansionInfo info;
+ info.table_id = {getDatabaseName(), query.getTable(), query.uuid};
+ info.shard = getShardName();
+ info.replica = getReplicaName();
+ query_context->getMacros()->expand(maybe_path, info);
+ bool maybe_shard_macros = info.expanded_other;
+ info.expanded_other = false;
+ query_context->getMacros()->expand(maybe_replica, info);
+ bool maybe_replica_macros = info.expanded_other;
+ bool enable_functional_tests_helper = getContext()->getConfigRef().has("_functional_tests_helper_database_replicated_replace_args_macros");
+
+ if (!enable_functional_tests_helper)
+ {
+ if (query_context->getSettingsRef().database_replicated_allow_replicated_engine_arguments)
+ LOG_WARNING(log, "It's not recommended to explicitly specify zookeeper_path and replica_name in ReplicatedMergeTree arguments");
+ else
+ throw Exception(ErrorCodes::INCORRECT_QUERY,
+ "It's not allowed to specify explicit zookeeper_path and replica_name "
+ "for ReplicatedMergeTree arguments in Replicated database. If you really want to "
+ "specify them explicitly, enable setting "
+ "database_replicated_allow_replicated_engine_arguments.");
+ }
+
+ if (maybe_shard_macros && maybe_replica_macros)
+ return;
+
+ if (enable_functional_tests_helper && !has_expression_argument)
+ {
+ if (maybe_path.empty() || maybe_path.back() != '/')
+ maybe_path += '/';
+ args_ref[0]->as()->value = maybe_path + "auto_{shard}";
+ args_ref[1]->as()->value = maybe_replica + "auto_{replica}";
+ return;
+ }
+
+ throw Exception(ErrorCodes::INCORRECT_QUERY,
+ "Explicit zookeeper_path and replica_name are specified in ReplicatedMergeTree arguments. "
+ "If you really want to specify it explicitly, then you should use some macros "
+ "to distinguish different shards and replicas");
+}
+
BlockIO DatabaseReplicated::tryEnqueueReplicatedDDL(const ASTPtr & query, ContextPtr query_context, QueryFlags flags)
{
waitDatabaseStarted();
@@ -1312,11 +1324,9 @@ ASTPtr DatabaseReplicated::parseQueryFromMetadataInZooKeeper(const String & node
if (create.uuid == UUIDHelpers::Nil || create.getTable() != TABLE_WITH_UUID_NAME_PLACEHOLDER || create.database)
throw Exception(ErrorCodes::LOGICAL_ERROR, "Got unexpected query from {}: {}", node_name, query);
- bool is_materialized_view_with_inner_table = create.is_materialized_view && create.to_table_id.empty();
-
create.setDatabase(getDatabaseName());
create.setTable(unescapeForFileName(node_name));
- create.attach = is_materialized_view_with_inner_table;
+ create.attach = create.is_materialized_view_with_inner_table();
return ast;
}
diff --git a/src/Databases/DatabaseReplicated.h b/src/Databases/DatabaseReplicated.h
index eab5b2ff931..8c3fa7c87f6 100644
--- a/src/Databases/DatabaseReplicated.h
+++ b/src/Databases/DatabaseReplicated.h
@@ -107,6 +107,7 @@ private:
void fillClusterAuthInfo(String collection_name, const Poco::Util::AbstractConfiguration & config);
void checkQueryValid(const ASTPtr & query, ContextPtr query_context) const;
+ void checkTableEngine(const ASTCreateQuery & query, ASTStorage & storage, ContextPtr query_context) const;
void recoverLostReplica(const ZooKeeperPtr & current_zookeeper, UInt32 our_log_ptr, UInt32 & max_log_ptr);
diff --git a/src/Databases/DatabasesCommon.cpp b/src/Databases/DatabasesCommon.cpp
index fe0baf30e57..6ccaf811764 100644
--- a/src/Databases/DatabasesCommon.cpp
+++ b/src/Databases/DatabasesCommon.cpp
@@ -289,8 +289,8 @@ StoragePtr DatabaseWithOwnTablesBase::detachTableUnlocked(const String & table_n
tables.erase(it);
table_storage->is_detached = true;
- if (table_storage->isSystemStorage() == false)
- CurrentMetrics::sub(getAttachedCounterForStorage(table_storage), 1);
+ if (!table_storage->isSystemStorage() && database_name != DatabaseCatalog::SYSTEM_DATABASE)
+ CurrentMetrics::sub(getAttachedCounterForStorage(table_storage));
auto table_id = table_storage->getStorageID();
if (table_id.hasUUID())
@@ -334,8 +334,8 @@ void DatabaseWithOwnTablesBase::attachTableUnlocked(const String & table_name, c
/// non-Atomic database the is_detached is set to true before RENAME.
table->is_detached = false;
- if (table->isSystemStorage() == false && table_id.database_name != DatabaseCatalog::SYSTEM_DATABASE)
- CurrentMetrics::add(getAttachedCounterForStorage(table), 1);
+ if (!table->isSystemStorage() && table_id.database_name != DatabaseCatalog::SYSTEM_DATABASE)
+ CurrentMetrics::add(getAttachedCounterForStorage(table));
}
void DatabaseWithOwnTablesBase::shutdown()
diff --git a/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp b/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp
index e9c642666d3..198f6c0ea04 100644
--- a/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp
+++ b/src/Disks/IO/CachedOnDiskReadBufferFromFile.cpp
@@ -59,7 +59,7 @@ CachedOnDiskReadBufferFromFile::CachedOnDiskReadBufferFromFile(
std::optional read_until_position_,
std::shared_ptr cache_log_)
: ReadBufferFromFileBase(use_external_buffer_ ? 0 : settings_.remote_fs_buffer_size, nullptr, 0, file_size_)
-#ifdef ABORT_ON_LOGICAL_ERROR
+#ifdef DEBUG_OR_SANITIZER_BUILD
, log(getLogger(fmt::format("CachedOnDiskReadBufferFromFile({})", cache_key_)))
#else
, log(getLogger("CachedOnDiskReadBufferFromFile"))
@@ -452,7 +452,7 @@ CachedOnDiskReadBufferFromFile::getImplementationBuffer(FileSegment & file_segme
{
case ReadType::CACHED:
{
-#ifdef ABORT_ON_LOGICAL_ERROR
+#ifdef DEBUG_OR_SANITIZER_BUILD
size_t file_size = getFileSizeFromReadBuffer(*read_buffer_for_file_segment);
if (file_size == 0 || range.left + file_size <= file_offset_of_buffer_end)
throw Exception(
@@ -937,7 +937,7 @@ bool CachedOnDiskReadBufferFromFile::nextImplStep()
if (!result)
{
-#ifdef ABORT_ON_LOGICAL_ERROR
+#ifdef DEBUG_OR_SANITIZER_BUILD
if (read_type == ReadType::CACHED)
{
size_t cache_file_size = getFileSizeFromReadBuffer(*implementation_buffer);
diff --git a/src/Functions/DateTimeTransforms.h b/src/Functions/DateTimeTransforms.h
index 34c59ecab08..5f745f3ccad 100644
--- a/src/Functions/DateTimeTransforms.h
+++ b/src/Functions/DateTimeTransforms.h
@@ -1954,7 +1954,10 @@ struct ToRelativeSubsecondNumImpl
return t.value;
if (scale > scale_multiplier)
return t.value / (scale / scale_multiplier);
- return t.value * (scale_multiplier / scale);
+ return static_cast(t.value) * static_cast((scale_multiplier / scale));
+ /// Casting ^^: All integers are Int64, yet if t.value is big enough the multiplication can still
+ /// overflow which is UB. This place is too low-level and generic to check if t.value is sane.
+ /// Therefore just let it overflow safely and don't bother further.
}
static Int64 execute(UInt32 t, const DateLUTImpl &)
{
diff --git a/src/Functions/acosh.cpp b/src/Functions/acosh.cpp
index 5b071da9c40..2bab84c77af 100644
--- a/src/Functions/acosh.cpp
+++ b/src/Functions/acosh.cpp
@@ -5,11 +5,12 @@ namespace DB
{
namespace
{
- struct AcoshName
- {
- static constexpr auto name = "acosh";
- };
- using FunctionAcosh = FunctionMathUnary>;
+
+struct AcoshName
+{
+ static constexpr auto name = "acosh";
+};
+using FunctionAcosh = FunctionMathUnary>;
}
diff --git a/src/Functions/addMicroseconds.cpp b/src/Functions/addMicroseconds.cpp
index 0dcd6b4452f..8c0ae06dcd0 100644
--- a/src/Functions/addMicroseconds.cpp
+++ b/src/Functions/addMicroseconds.cpp
@@ -6,6 +6,7 @@ namespace DB
{
using FunctionAddMicroseconds = FunctionDateOrDateTimeAddInterval;
+
REGISTER_FUNCTION(AddMicroseconds)
{
factory.registerFunction();
diff --git a/src/Functions/addMilliseconds.cpp b/src/Functions/addMilliseconds.cpp
index 0e2b696d367..83e1f96ec4b 100644
--- a/src/Functions/addMilliseconds.cpp
+++ b/src/Functions/addMilliseconds.cpp
@@ -6,6 +6,7 @@ namespace DB
{
using FunctionAddMilliseconds = FunctionDateOrDateTimeAddInterval;
+
REGISTER_FUNCTION(AddMilliseconds)
{
factory.registerFunction();
diff --git a/src/Functions/addNanoseconds.cpp b/src/Functions/addNanoseconds.cpp
index 93eadc814d9..8f9a54752b9 100644
--- a/src/Functions/addNanoseconds.cpp
+++ b/src/Functions/addNanoseconds.cpp
@@ -6,6 +6,7 @@ namespace DB
{
using FunctionAddNanoseconds = FunctionDateOrDateTimeAddInterval;
+
REGISTER_FUNCTION(AddNanoseconds)
{
factory.registerFunction();
diff --git a/src/Functions/aes_encrypt_mysql.cpp b/src/Functions/aes_encrypt_mysql.cpp
index fb120151c25..33733f92b27 100644
--- a/src/Functions/aes_encrypt_mysql.cpp
+++ b/src/Functions/aes_encrypt_mysql.cpp
@@ -7,7 +7,6 @@
namespace DB
{
-
namespace
{
diff --git a/src/Functions/appendTrailingCharIfAbsent.cpp b/src/Functions/appendTrailingCharIfAbsent.cpp
index a5554171aaa..0e57d5c55ce 100644
--- a/src/Functions/appendTrailingCharIfAbsent.cpp
+++ b/src/Functions/appendTrailingCharIfAbsent.cpp
@@ -57,7 +57,7 @@ private:
bool useDefaultImplementationForConstants() const override { return true; }
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {1}; }
- ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t /*input_rows_count*/) const override
+ ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
{
const auto & column = arguments[0].column;
const auto & column_char = arguments[1].column;
@@ -80,14 +80,13 @@ private:
auto & dst_data = col_res->getChars();
auto & dst_offsets = col_res->getOffsets();
- const auto size = src_offsets.size();
- dst_data.resize(src_data.size() + size);
- dst_offsets.resize(size);
+ dst_data.resize(src_data.size() + input_rows_count);
+ dst_offsets.resize(input_rows_count);
ColumnString::Offset src_offset{};
ColumnString::Offset dst_offset{};
- for (const auto i : collections::range(0, size))
+ for (size_t i = 0; i < input_rows_count; ++i)
{
const auto src_length = src_offsets[i] - src_offset;
memcpySmallAllowReadWriteOverflow15(&dst_data[dst_offset], &src_data[src_offset], src_length);
diff --git a/src/Functions/ascii.cpp b/src/Functions/ascii.cpp
index 7c8158b53d4..0d50e5d203b 100644
--- a/src/Functions/ascii.cpp
+++ b/src/Functions/ascii.cpp
@@ -45,9 +45,7 @@ struct AsciiImpl
size_t size = data.size() / n;
for (size_t i = 0; i < size; ++i)
- {
res[i] = doAscii(data, i * n, n);
- }
}
[[noreturn]] static void array(const ColumnString::Offsets & /*offsets*/, PaddedPODArray & /*res*/)
diff --git a/src/Functions/asinh.cpp b/src/Functions/asinh.cpp
index 6af832ae07c..b5e3626148f 100644
--- a/src/Functions/asinh.cpp
+++ b/src/Functions/asinh.cpp
@@ -5,11 +5,12 @@ namespace DB
{
namespace
{
- struct AsinhName
- {
- static constexpr auto name = "asinh";
- };
- using FunctionAsinh = FunctionMathUnary>;
+
+struct AsinhName
+{
+ static constexpr auto name = "asinh";
+};
+using FunctionAsinh = FunctionMathUnary>;
}
diff --git a/src/Functions/atan2.cpp b/src/Functions/atan2.cpp
index 42294e11458..218f4c5406f 100644
--- a/src/Functions/atan2.cpp
+++ b/src/Functions/atan2.cpp
@@ -5,11 +5,12 @@ namespace DB
{
namespace
{
- struct Atan2Name
- {
- static constexpr auto name = "atan2";
- };
- using FunctionAtan2 = FunctionMathBinaryFloat64>;
+
+struct Atan2Name
+{
+ static constexpr auto name = "atan2";
+};
+using FunctionAtan2 = FunctionMathBinaryFloat64>;
}
diff --git a/src/Functions/atanh.cpp b/src/Functions/atanh.cpp
index fab25414725..a36f5bcbcf0 100644
--- a/src/Functions/atanh.cpp
+++ b/src/Functions/atanh.cpp
@@ -5,11 +5,12 @@ namespace DB
{
namespace
{
- struct AtanhName
- {
- static constexpr auto name = "atanh";
- };
- using FunctionAtanh = FunctionMathUnary>;
+
+struct AtanhName
+{
+ static constexpr auto name = "atanh";
+};
+using FunctionAtanh = FunctionMathUnary>;
}
diff --git a/src/Functions/base58Encode.cpp b/src/Functions/base58Encode.cpp
index cf790ebddab..3ae2fb12c5e 100644
--- a/src/Functions/base58Encode.cpp
+++ b/src/Functions/base58Encode.cpp
@@ -3,8 +3,10 @@
namespace DB
{
+
REGISTER_FUNCTION(Base58Encode)
{
factory.registerFunction>();
}
+
}
diff --git a/src/Functions/base64Decode.cpp b/src/Functions/base64Decode.cpp
index 4d06ac99d6f..349475af3f0 100644
--- a/src/Functions/base64Decode.cpp
+++ b/src/Functions/base64Decode.cpp
@@ -5,6 +5,7 @@
namespace DB
{
+
REGISTER_FUNCTION(Base64Decode)
{
FunctionDocumentation::Description description = R"(Accepts a String and decodes it from base64, according to RFC 4648 (https://datatracker.ietf.org/doc/html/rfc4648#section-4). Throws an exception in case of an error. Alias: FROM_BASE64.)";
@@ -19,6 +20,7 @@ REGISTER_FUNCTION(Base64Decode)
/// MySQL compatibility alias.
factory.registerAlias("FROM_BASE64", "base64Decode", FunctionFactory::Case::Insensitive);
}
+
}
#endif
diff --git a/src/Functions/base64Encode.cpp b/src/Functions/base64Encode.cpp
index 64142995552..fe0fa642599 100644
--- a/src/Functions/base64Encode.cpp
+++ b/src/Functions/base64Encode.cpp
@@ -5,6 +5,7 @@
namespace DB
{
+
REGISTER_FUNCTION(Base64Encode)
{
FunctionDocumentation::Description description = R"(Encodes a String as base64, according to RFC 4648 (https://datatracker.ietf.org/doc/html/rfc4648#section-4). Alias: TO_BASE64.)";
@@ -19,6 +20,7 @@ REGISTER_FUNCTION(Base64Encode)
/// MySQL compatibility alias.
factory.registerAlias("TO_BASE64", "base64Encode", FunctionFactory::Case::Insensitive);
}
+
}
#endif
diff --git a/src/Functions/base64URLDecode.cpp b/src/Functions/base64URLDecode.cpp
index f5766dc60bd..f256e111619 100644
--- a/src/Functions/base64URLDecode.cpp
+++ b/src/Functions/base64URLDecode.cpp
@@ -5,6 +5,7 @@
namespace DB
{
+
REGISTER_FUNCTION(Base64URLDecode)
{
FunctionDocumentation::Description description = R"(Accepts a base64-encoded URL and decodes it from base64 with URL-specific modifications, according to RFC 4648 (https://datatracker.ietf.org/doc/html/rfc4648#section-5).)";
@@ -16,6 +17,7 @@ REGISTER_FUNCTION(Base64URLDecode)
factory.registerFunction>>({description, syntax, arguments, returned_value, examples, categories});
}
+
}
#endif
diff --git a/src/Functions/base64URLEncode.cpp b/src/Functions/base64URLEncode.cpp
index 73a465a30c5..215712f7586 100644
--- a/src/Functions/base64URLEncode.cpp
+++ b/src/Functions/base64URLEncode.cpp
@@ -5,6 +5,7 @@
namespace DB
{
+
REGISTER_FUNCTION(Base64URLEncode)
{
FunctionDocumentation::Description description = R"(Encodes an URL (String or FixedString) as base64 with URL-specific modifications, according to RFC 4648 (https://datatracker.ietf.org/doc/html/rfc4648#section-5).)";
@@ -16,6 +17,7 @@ REGISTER_FUNCTION(Base64URLEncode)
factory.registerFunction>>({description, syntax, arguments, returned_value, examples, categories});
}
+
}
#endif
diff --git a/src/Functions/byteSize.cpp b/src/Functions/byteSize.cpp
index 93a3a86641a..d366a1b2e12 100644
--- a/src/Functions/byteSize.cpp
+++ b/src/Functions/byteSize.cpp
@@ -67,11 +67,11 @@ public:
const IColumn * column = arguments[arg_num].column.get();
if (arg_num == 0)
- for (size_t row_num = 0; row_num < input_rows_count; ++row_num)
- vec_res[row_num] = column->byteSizeAt(row_num);
+ for (size_t row = 0; row < input_rows_count; ++row)
+ vec_res[row] = column->byteSizeAt(row);
else
- for (size_t row_num = 0; row_num < input_rows_count; ++row_num)
- vec_res[row_num] += column->byteSizeAt(row_num);
+ for (size_t row = 0; row < input_rows_count; ++row)
+ vec_res[row] += column->byteSizeAt(row);
}
return result_col;
diff --git a/src/Functions/byteSwap.cpp b/src/Functions/byteSwap.cpp
index 6c824b851b0..2094ec4fa1a 100644
--- a/src/Functions/byteSwap.cpp
+++ b/src/Functions/byteSwap.cpp
@@ -10,6 +10,7 @@ extern const int NOT_IMPLEMENTED;
namespace
{
+
template
requires std::is_integral_v
T byteSwap(T x)
diff --git a/src/Functions/caseWithExpression.cpp b/src/Functions/caseWithExpression.cpp
index 71fccc8436e..f0a620489ef 100644
--- a/src/Functions/caseWithExpression.cpp
+++ b/src/Functions/caseWithExpression.cpp
@@ -98,8 +98,7 @@ public:
/// Execute transform.
ColumnsWithTypeAndName transform_args{args.front(), src_array_col, dst_array_col, args.back()};
- return FunctionFactory::instance().get("transform", context)->build(transform_args)
- ->execute(transform_args, result_type, input_rows_count);
+ return FunctionFactory::instance().get("transform", context)->build(transform_args)->execute(transform_args, result_type, input_rows_count);
}
private:
diff --git a/src/Functions/convertCharset.cpp b/src/Functions/convertCharset.cpp
index b3b7394acb9..d998e88e7c2 100644
--- a/src/Functions/convertCharset.cpp
+++ b/src/Functions/convertCharset.cpp
@@ -88,7 +88,8 @@ private:
static void convert(const String & from_charset, const String & to_charset,
const ColumnString::Chars & from_chars, const ColumnString::Offsets & from_offsets,
- ColumnString::Chars & to_chars, ColumnString::Offsets & to_offsets)
+ ColumnString::Chars & to_chars, ColumnString::Offsets & to_offsets,
+ size_t input_rows_count)
{
auto converter_from = getConverter(from_charset);
auto converter_to = getConverter(to_charset);
@@ -96,12 +97,11 @@ private:
ColumnString::Offset current_from_offset = 0;
ColumnString::Offset current_to_offset = 0;
- size_t size = from_offsets.size();
- to_offsets.resize(size);
+ to_offsets.resize(input_rows_count);
PODArray uchars;
- for (size_t i = 0; i < size; ++i)
+ for (size_t i = 0; i < input_rows_count; ++i)
{
size_t from_string_size = from_offsets[i] - current_from_offset - 1;
@@ -184,7 +184,7 @@ public:
bool useDefaultImplementationForConstants() const override { return true; }
ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {1, 2}; }
- ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t /*input_rows_count*/) const override
+ ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
{
const ColumnWithTypeAndName & arg_from = arguments[0];
const ColumnWithTypeAndName & arg_charset_from = arguments[1];
@@ -204,7 +204,7 @@ public:
if (const ColumnString * col_from = checkAndGetColumn(arg_from.column.get()))
{
auto col_to = ColumnString::create();
- convert(charset_from, charset_to, col_from->getChars(), col_from->getOffsets(), col_to->getChars(), col_to->getOffsets());
+ convert(charset_from, charset_to, col_from->getChars(), col_from->getOffsets(), col_to->getChars(), col_to->getOffsets(), input_rows_count);
return col_to;
}
else
diff --git a/src/Functions/cosh.cpp b/src/Functions/cosh.cpp
index 54b52051aab..f4302292303 100644
--- a/src/Functions/cosh.cpp
+++ b/src/Functions/cosh.cpp
@@ -5,11 +5,12 @@ namespace DB
{
namespace
{
- struct CoshName
- {
- static constexpr auto name = "cosh";
- };
- using FunctionCosh = FunctionMathUnary>;
+
+struct CoshName
+{
+ static constexpr auto name = "cosh";
+};
+using FunctionCosh = FunctionMathUnary>;
}
diff --git a/src/Functions/countSubstringsCaseInsensitiveUTF8.cpp b/src/Functions/countSubstringsCaseInsensitiveUTF8.cpp
index 3f71bca63d2..99ae4f1927e 100644
--- a/src/Functions/countSubstringsCaseInsensitiveUTF8.cpp
+++ b/src/Functions/countSubstringsCaseInsensitiveUTF8.cpp
@@ -13,8 +13,7 @@ struct NameCountSubstringsCaseInsensitiveUTF8
static constexpr auto name = "countSubstringsCaseInsensitiveUTF8";
};
-using FunctionCountSubstringsCaseInsensitiveUTF8 = FunctionsStringSearch<
- CountSubstringsImpl>;
+using FunctionCountSubstringsCaseInsensitiveUTF8 = FunctionsStringSearch>;
}
diff --git a/src/Functions/dateDiff.cpp b/src/Functions/dateDiff.cpp
index f49e8dee6b7..157068a7c8d 100644
--- a/src/Functions/dateDiff.cpp
+++ b/src/Functions/dateDiff.cpp
@@ -26,8 +26,6 @@ namespace DB
namespace ErrorCodes
{
- extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH;
- extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int ILLEGAL_COLUMN;
extern const int BAD_ARGUMENTS;
}
@@ -45,84 +43,82 @@ public:
template
void dispatchForColumns(
- const IColumn & x, const IColumn & y,
+ const IColumn & col_x, const IColumn & col_y,
const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
+ size_t input_rows_count,
ColumnInt64::Container & result) const
{
- if (const auto * x_vec_16 = checkAndGetColumn(&x))
- dispatchForSecondColumn(*x_vec_16, y, timezone_x, timezone_y, result);
- else if (const auto * x_vec_32 = checkAndGetColumn(&x))
- dispatchForSecondColumn(*x_vec_32, y, timezone_x, timezone_y, result);
- else if (const auto * x_vec_32_s = checkAndGetColumn(&x))
- dispatchForSecondColumn(*x_vec_32_s, y, timezone_x, timezone_y, result);
- else if (const auto * x_vec_64 = checkAndGetColumn(&x))
- dispatchForSecondColumn(*x_vec_64, y, timezone_x, timezone_y, result);
- else if (const auto * x_const_16 = checkAndGetColumnConst(&x))
- dispatchConstForSecondColumn(x_const_16->getValue(), y, timezone_x, timezone_y, result);
- else if (const auto * x_const_32 = checkAndGetColumnConst(&x))
- dispatchConstForSecondColumn(x_const_32->getValue(), y, timezone_x, timezone_y, result);
- else if (const auto * x_const_32_s = checkAndGetColumnConst(&x))
- dispatchConstForSecondColumn(x_const_32_s->getValue(), y, timezone_x, timezone_y, result);
- else if (const auto * x_const_64 = checkAndGetColumnConst(&x))
- dispatchConstForSecondColumn(x_const_64->getValue>(), y, timezone_x, timezone_y, result);
+ if (const auto * x_vec_16 = checkAndGetColumn(&col_x))
+ dispatchForSecondColumn(*x_vec_16, col_y, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * x_vec_32 = checkAndGetColumn(&col_x))
+ dispatchForSecondColumn(*x_vec_32, col_y, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * x_vec_32_s = checkAndGetColumn(&col_x))
+ dispatchForSecondColumn(*x_vec_32_s, col_y, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * x_vec_64 = checkAndGetColumn(&col_x))
+ dispatchForSecondColumn(*x_vec_64, col_y, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * x_const_16 = checkAndGetColumnConst(&col_x))
+ dispatchConstForSecondColumn(x_const_16->getValue(), col_y, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * x_const_32 = checkAndGetColumnConst(&col_x))
+ dispatchConstForSecondColumn(x_const_32->getValue(), col_y, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * x_const_32_s = checkAndGetColumnConst(&col_x))
+ dispatchConstForSecondColumn(x_const_32_s->getValue(), col_y, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * x_const_64 = checkAndGetColumnConst(&col_x))
+ dispatchConstForSecondColumn(x_const_64->getValue>(), col_y, timezone_x, timezone_y, input_rows_count, result);
else
- throw Exception(ErrorCodes::ILLEGAL_COLUMN,
- "Illegal column for first argument of function {}, must be Date, Date32, DateTime or DateTime64",
- name);
+ throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column for first argument of function {}, must be Date, Date32, DateTime or DateTime64", name);
}
template
void dispatchForSecondColumn(
- const LeftColumnType & x, const IColumn & y,
+ const LeftColumnType & x, const IColumn & col_y,
const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
+ size_t input_rows_count,
ColumnInt64::Container & result) const
{
- if (const auto * y_vec_16 = checkAndGetColumn(&y))
- vectorVector(x, *y_vec_16, timezone_x, timezone_y, result);
- else if (const auto * y_vec_32 = checkAndGetColumn(&y))
- vectorVector(x, *y_vec_32, timezone_x, timezone_y, result);
- else if (const auto * y_vec_32_s = checkAndGetColumn(&y))
- vectorVector(x, *y_vec_32_s, timezone_x, timezone_y, result);
- else if (const auto * y_vec_64 = checkAndGetColumn(&y))
- vectorVector(x, *y_vec_64, timezone_x, timezone_y, result);
- else if (const auto * y_const_16 = checkAndGetColumnConst(&y))
- vectorConstant(x, y_const_16->getValue(), timezone_x, timezone_y, result);
- else if (const auto * y_const_32 = checkAndGetColumnConst(&y))
- vectorConstant(x, y_const_32->getValue(), timezone_x, timezone_y, result);
- else if (const auto * y_const_32_s = checkAndGetColumnConst(&y))
- vectorConstant(x, y_const_32_s->getValue(), timezone_x, timezone_y, result);
- else if (const auto * y_const_64 = checkAndGetColumnConst(&y))
- vectorConstant(x, y_const_64->getValue>(), timezone_x, timezone_y, result);
+ if (const auto * y_vec_16 = checkAndGetColumn(&col_y))
+ vectorVector(x, *y_vec_16, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_vec_32 = checkAndGetColumn(&col_y))
+ vectorVector(x, *y_vec_32, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_vec_32_s = checkAndGetColumn(&col_y))
+ vectorVector(x, *y_vec_32_s, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_vec_64 = checkAndGetColumn(&col_y))
+ vectorVector(x, *y_vec_64, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_const_16 = checkAndGetColumnConst(&col_y))
+ vectorConstant(x, y_const_16->getValue(), timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_const_32 = checkAndGetColumnConst(&col_y))
+ vectorConstant(x, y_const_32->getValue(), timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_const_32_s = checkAndGetColumnConst(&col_y))
+ vectorConstant(x, y_const_32_s->getValue(), timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_const_64 = checkAndGetColumnConst(&col_y))
+ vectorConstant(x, y_const_64->getValue>(), timezone_x, timezone_y, input_rows_count, result);
else
- throw Exception(ErrorCodes::ILLEGAL_COLUMN,
- "Illegal column for second argument of function {}, must be Date, Date32, DateTime or DateTime64",
- name);
+ throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column for second argument of function {}, must be Date, Date32, DateTime or DateTime64", name);
}
template
void dispatchConstForSecondColumn(
- T1 x, const IColumn & y,
+ T1 x, const IColumn & col_y,
const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
+ size_t input_rows_count,
ColumnInt64::Container & result) const
{
- if (const auto * y_vec_16 = checkAndGetColumn(&y))
- constantVector(x, *y_vec_16, timezone_x, timezone_y, result);
- else if (const auto * y_vec_32 = checkAndGetColumn(&y))
- constantVector(x, *y_vec_32, timezone_x, timezone_y, result);
- else if (const auto * y_vec_32_s = checkAndGetColumn(&y))
- constantVector(x, *y_vec_32_s, timezone_x, timezone_y, result);
- else if (const auto * y_vec_64 = checkAndGetColumn(&y))
- constantVector(x, *y_vec_64, timezone_x, timezone_y, result);
+ if (const auto * y_vec_16 = checkAndGetColumn(&col_y))
+ constantVector(x, *y_vec_16, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_vec_32 = checkAndGetColumn(&col_y))
+ constantVector(x, *y_vec_32, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_vec_32_s = checkAndGetColumn(&col_y))
+ constantVector(x, *y_vec_32_s, timezone_x, timezone_y, input_rows_count, result);
+ else if (const auto * y_vec_64 = checkAndGetColumn(&col_y))
+ constantVector(x, *y_vec_64, timezone_x, timezone_y, input_rows_count, result);
else
- throw Exception(ErrorCodes::ILLEGAL_COLUMN,
- "Illegal column for second argument of function {}, must be Date, Date32, DateTime or DateTime64",
- name);
+ throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column for second argument of function {}, must be Date, Date32, DateTime or DateTime64", name);
}
template
void vectorVector(
const LeftColumnType & x, const RightColumnType & y,
const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
+ size_t input_rows_count,
ColumnInt64::Container & result) const
{
const auto & x_data = x.getData();
@@ -130,14 +126,15 @@ public:
const auto transform_x = TransformDateTime64(getScale(x));
const auto transform_y = TransformDateTime64(getScale(y));
- for (size_t i = 0, size = x.size(); i < size; ++i)
- result[i] = calculate(transform_x, transform_y, x_data[i], y_data[i], timezone_x, timezone_y);
+ for (size_t i = 0; i < input_rows_count; ++i)
+ result[i] = calculate(transform_x, transform_y, x_data[i], y_data[i], timezone_x, timezone_y);
}
template
void vectorConstant(
const LeftColumnType & x, T2 y,
const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
+ size_t input_rows_count,
ColumnInt64::Container & result) const
{
const auto & x_data = x.getData();
@@ -145,7 +142,7 @@ public:
const auto transform_y = TransformDateTime64(getScale(y));
const auto y_value = stripDecimalFieldValue(y);
- for (size_t i = 0, size = x.size(); i < size; ++i)
+ for (size_t i = 0; i < input_rows_count; ++i)
result[i] = calculate(transform_x, transform_y, x_data[i], y_value, timezone_x, timezone_y);
}
@@ -153,6 +150,7 @@ public:
void constantVector(
T1 x, const RightColumnType & y,
const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y,
+ size_t input_rows_count,
ColumnInt64::Container & result) const
{
const auto & y_data = y.getData();
@@ -160,20 +158,22 @@ public:
const auto transform_y = TransformDateTime64(getScale(y));
const auto x_value = stripDecimalFieldValue(x);
- for (size_t i = 0, size = y.size(); i < size; ++i)
+ for (size_t i = 0; i < input_rows_count; ++i)
result[i] = calculate(transform_x, transform_y, x_value, y_data[i], timezone_x, timezone_y);
}
template
Int64 calculate(const TransformX & transform_x, const TransformY & transform_y, T1 x, T2 y, const DateLUTImpl & timezone_x, const DateLUTImpl & timezone_y) const
{
+ auto res = static_cast(transform_y.execute(y, timezone_y)) - static_cast(transform_x.execute(x, timezone_x));
+
if constexpr (is_diff)
- return static_cast(transform_y.execute(y, timezone_y))
- - static_cast(transform_x.execute(x, timezone_x));
+ {
+ return res;
+ }
else
{
- auto res = static_cast(transform_y.execute(y, timezone_y))
- - static_cast(transform_x.execute(x, timezone_x));
+ /// Adjust res:
DateTimeComponentsWithFractionalPart a_comp;
DateTimeComponentsWithFractionalPart b_comp;
Int64 adjust_value;
@@ -332,95 +332,73 @@ public:
static constexpr auto name = is_relative ? "dateDiff" : "age";
static FunctionPtr create(ContextPtr) { return std::make_shared(); }
- String getName() const override
- {
- return name;
- }
+ String getName() const override { return name; }
bool isVariadic() const override { return true; }
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return true; }
size_t getNumberOfArguments() const override { return 0; }
+ bool useDefaultImplementationForConstants() const override { return true; }
+ ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {0, 3}; }
- DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
+ DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{
- if (arguments.size() != 3 && arguments.size() != 4)
- throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
- "Number of arguments for function {} doesn't match: passed {}, should be 3 or 4",
- getName(), arguments.size());
+ FunctionArgumentDescriptors mandatory_args{
+ {"unit", static_cast(&isString), nullptr, "String"},
+ {"startdate", static_cast(&isDateOrDate32OrDateTimeOrDateTime64), nullptr, "Date[32] or DateTime[64]"},
+ {"enddate", static_cast(&isDateOrDate32OrDateTimeOrDateTime64), nullptr, "Date[32] or DateTime[64]"},
+ };
- if (!isString(arguments[0]))
- throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
- "First argument for function {} (unit) must be String",
- getName());
+ FunctionArgumentDescriptors optional_args{
+ {"timezone", static_cast(&isString), nullptr, "String"},
+ };
- if (!isDate(arguments[1]) && !isDate32(arguments[1]) && !isDateTime(arguments[1]) && !isDateTime64(arguments[1]))
- throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
- "Second argument for function {} must be Date, Date32, DateTime or DateTime64",
- getName());
-
- if (!isDate(arguments[2]) && !isDate32(arguments[2]) && !isDateTime(arguments[2]) && !isDateTime64(arguments[2]))
- throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
- "Third argument for function {} must be Date, Date32, DateTime or DateTime64",
- getName()
- );
-
- if (arguments.size() == 4 && !isString(arguments[3]))
- throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
- "Fourth argument for function {} (timezone) must be String",
- getName());
+ validateFunctionArguments(*this, arguments, mandatory_args, optional_args);
return std::make_shared();
}
- bool useDefaultImplementationForConstants() const override { return true; }
- ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {0, 3}; }
-
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
{
- const auto * unit_column = checkAndGetColumnConst(arguments[0].column.get());
- if (!unit_column)
- throw Exception(ErrorCodes::ILLEGAL_COLUMN,
- "First argument for function {} must be constant String",
- getName());
+ const auto * col_unit = checkAndGetColumnConst(arguments[0].column.get());
+ if (!col_unit)
+ throw Exception(ErrorCodes::ILLEGAL_COLUMN, "First argument for function {} must be constant String", getName());
- String unit = Poco::toLower(unit_column->getValue());
+ String unit = Poco::toLower(col_unit->getValue());
- const IColumn & x = *arguments[1].column;
- const IColumn & y = *arguments[2].column;
+ const IColumn & col_x = *arguments[1].column;
+ const IColumn & col_y = *arguments[2].column;
- size_t rows = input_rows_count;
- auto res = ColumnInt64::create(rows);
+ auto col_res = ColumnInt64::create(input_rows_count);
const auto & timezone_x = extractTimeZoneFromFunctionArguments(arguments, 3, 1);
const auto & timezone_y = extractTimeZoneFromFunctionArguments(arguments, 3, 2);
if (unit == "year" || unit == "years" || unit == "yy" || unit == "yyyy")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "quarter" || unit == "quarters" || unit == "qq" || unit == "q")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "month" || unit == "months" || unit == "mm" || unit == "m")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "week" || unit == "weeks" || unit == "wk" || unit == "ww")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "day" || unit == "days" || unit == "dd" || unit == "d")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "hour" || unit == "hours" || unit == "hh" || unit == "h")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "minute" || unit == "minutes" || unit == "mi" || unit == "n")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "second" || unit == "seconds" || unit == "ss" || unit == "s")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "millisecond" || unit == "milliseconds" || unit == "ms")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "microsecond" || unit == "microseconds" || unit == "us" || unit == "u")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else if (unit == "nanosecond" || unit == "nanoseconds" || unit == "ns")
- impl.template dispatchForColumns>(x, y, timezone_x, timezone_y, res->getData());
+ impl.template dispatchForColumns>(col_x, col_y, timezone_x, timezone_y, input_rows_count, col_res->getData());
else
- throw Exception(ErrorCodes::BAD_ARGUMENTS,
- "Function {} does not support '{}' unit", getName(), unit);
+ throw Exception(ErrorCodes::BAD_ARGUMENTS, "Function {} does not support '{}' unit", getName(), unit);
- return res;
+ return col_res;
}
private:
DateDiffImpl impl{name};
@@ -437,50 +415,35 @@ public:
static constexpr auto name = "timeDiff";
static FunctionPtr create(ContextPtr) { return std::make_shared(); }
- String getName() const override
- {
- return name;
- }
-
+ String getName() const override { return name; }
+ bool useDefaultImplementationForConstants() const override { return true; }
+ ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {}; }
bool isVariadic() const override { return false; }
bool isSuitableForShortCircuitArgumentsExecution(const DataTypesWithConstInfo & /*arguments*/) const override { return true; }
size_t getNumberOfArguments() const override { return 2; }
- DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
+ DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{
- if (arguments.size() != 2)
- throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
- "Number of arguments for function {} doesn't match: passed {}, should be 2",
- getName(), arguments.size());
+ FunctionArgumentDescriptors args{
+ {"first_datetime", static_cast(&isDateOrDate32OrDateTimeOrDateTime64), nullptr, "Date[32] or DateTime[64]"},
+ {"second_datetime", static_cast(&isDateOrDate32OrDateTimeOrDateTime64), nullptr, "Date[32] or DateTime[64]"},
+ };
- if (!isDate(arguments[0]) && !isDate32(arguments[0]) && !isDateTime(arguments[0]) && !isDateTime64(arguments[0]))
- throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
- "First argument for function {} must be Date, Date32, DateTime or DateTime64",
- getName());
-
- if (!isDate(arguments[1]) && !isDate32(arguments[1]) && !isDateTime(arguments[1]) && !isDateTime64(arguments[1]))
- throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
- "Second argument for function {} must be Date, Date32, DateTime or DateTime64",
- getName()
- );
+ validateFunctionArguments(*this, arguments, args);
return std::make_shared();
}
- bool useDefaultImplementationForConstants() const override { return true; }
- ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {}; }
-
ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
{
- const IColumn & x = *arguments[0].column;
- const IColumn & y = *arguments[1].column;
+ const IColumn & col_x = *arguments[0].column;
+ const IColumn & col_y = *arguments[1].column;
- size_t rows = input_rows_count;
- auto res = ColumnInt64::create(rows);
+ auto col_res = ColumnInt64::create(input_rows_count);
- impl.dispatchForColumns>(x, y, DateLUT::instance(), DateLUT::instance(), res->getData());
+ impl.dispatchForColumns>(col_x, col_y, DateLUT::instance(), DateLUT::instance(), input_rows_count, col_res->getData());
- return res;
+ return col_res;
}
private:
DateDiffImpl impl{name};
diff --git a/src/Functions/dateName.cpp b/src/Functions/dateName.cpp
index 8165ea1b8d3..846cb87f1ee 100644
--- a/src/Functions/dateName.cpp
+++ b/src/Functions/dateName.cpp
@@ -109,14 +109,14 @@ public:
ColumnPtr executeImpl(
const ColumnsWithTypeAndName & arguments,
const DataTypePtr & result_type,
- [[maybe_unused]] size_t input_rows_count) const override
+ size_t input_rows_count) const override
{
ColumnPtr res;
- if (!((res = executeType(arguments, result_type))
- || (res = executeType(arguments, result_type))
- || (res = executeType