From 56b388addf238513ec5602aeb99837882f95d30d Mon Sep 17 00:00:00 2001 From: kssenii Date: Wed, 19 May 2021 19:32:04 +0000 Subject: [PATCH] Add check for nullptr --- src/Storages/MergeTree/MergeTreePartition.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Storages/MergeTree/MergeTreePartition.cpp b/src/Storages/MergeTree/MergeTreePartition.cpp index 50848584207..471905c581d 100644 --- a/src/Storages/MergeTree/MergeTreePartition.cpp +++ b/src/Storages/MergeTree/MergeTreePartition.cpp @@ -228,6 +228,9 @@ Block MergeTreePartition::executePartitionByExpression(const StorageMetadataPtr KeyDescription MergeTreePartition::adjustPartitionKey(const StorageMetadataPtr & metadata_snapshot, ContextPtr context) { const auto & partition_key = metadata_snapshot->getPartitionKey(); + if (!partition_key.definition_ast) + return partition_key; + ASTPtr ast_copy = partition_key.definition_ast->clone(); /// Implementation of modulo function was changed from 8bit result type to 16bit. For backward compatibility partition by expression is always