diff --git a/src/Compression/CompressionFactory.cpp b/src/Compression/CompressionFactory.cpp index c8cd45cc49e..5d5c5c14de6 100644 --- a/src/Compression/CompressionFactory.cpp +++ b/src/Compression/CompressionFactory.cpp @@ -68,8 +68,11 @@ CompressionCodecPtr CompressionCodecFactory::get(const ASTPtr & ast, DataTypePtr else if (codecs.size() > 1) res = std::make_shared(codecs, sanity_check); - if (sanity_check && !res->isCompression()) - throw Exception("The combination of compression codecs " + res->getCodecDesc() + " does not compress anything." + /// Allow to explicitly specify single NONE codec if user don't want any compression. + /// But applying other transformations solely without compression (e.g. Delta) does not make sense. + if (sanity_check && !res->isCompression() && !res->isNone()) + throw Exception("Compression codec " + res->getCodecDesc() + " does not compress anything." + " You may want to add generic compression algorithm after other transformations, like: " + res->getCodecDesc() + ", LZ4." " (Note: you can enable setting 'allow_suspicious_codecs' to skip this check).", ErrorCodes::BAD_ARGUMENTS); diff --git a/tests/queries/0_stateless/00804_test_alter_compression_codecs.sql b/tests/queries/0_stateless/00804_test_alter_compression_codecs.sql index d071fc1831a..8a4cb9f81d7 100644 --- a/tests/queries/0_stateless/00804_test_alter_compression_codecs.sql +++ b/tests/queries/0_stateless/00804_test_alter_compression_codecs.sql @@ -28,6 +28,7 @@ SELECT * FROM alter_compression_codec ORDER BY id; OPTIMIZE TABLE alter_compression_codec FINAL; SELECT * FROM alter_compression_codec ORDER BY id; +SET allow_suspicious_codecs = 1; ALTER TABLE alter_compression_codec MODIFY COLUMN alter_column CODEC(ZSTD, LZ4HC, LZ4, LZ4, NONE); SELECT compression_codec FROM system.columns WHERE database = currentDatabase() AND table = 'alter_compression_codec' AND name = 'alter_column'; diff --git a/tests/queries/0_stateless/00804_test_custom_compression_codecs.sql b/tests/queries/0_stateless/00804_test_custom_compression_codecs.sql index 973230be60e..2c7b3b39469 100644 --- a/tests/queries/0_stateless/00804_test_custom_compression_codecs.sql +++ b/tests/queries/0_stateless/00804_test_custom_compression_codecs.sql @@ -1,4 +1,5 @@ SET send_logs_level = 'none'; +SET allow_suspicious_codecs = 1; DROP TABLE IF EXISTS compression_codec; diff --git a/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.sql b/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.sql index 5210b1d7706..f61adccefd5 100644 --- a/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.sql +++ b/tests/queries/0_stateless/00804_test_custom_compression_codes_log_storages.sql @@ -1,4 +1,5 @@ SET send_logs_level = 'none'; +SET allow_suspicious_codecs = 1; -- copy-paste for storage log diff --git a/tests/queries/0_stateless/00804_test_delta_codec_no_type_alter.sql b/tests/queries/0_stateless/00804_test_delta_codec_no_type_alter.sql index 69afc2d4915..f49b8b2ee32 100644 --- a/tests/queries/0_stateless/00804_test_delta_codec_no_type_alter.sql +++ b/tests/queries/0_stateless/00804_test_delta_codec_no_type_alter.sql @@ -1,4 +1,5 @@ SET send_logs_level = 'none'; +SET allow_suspicious_codecs = 1; DROP TABLE IF EXISTS delta_codec_for_alter; CREATE TABLE delta_codec_for_alter (date Date, x UInt32 Codec(Delta), s FixedString(128)) ENGINE = MergeTree ORDER BY tuple(); diff --git a/tests/queries/0_stateless/00910_zookeeper_custom_compression_codecs_replicated.sql b/tests/queries/0_stateless/00910_zookeeper_custom_compression_codecs_replicated.sql index d3bbbacd2a6..be83f040e04 100644 --- a/tests/queries/0_stateless/00910_zookeeper_custom_compression_codecs_replicated.sql +++ b/tests/queries/0_stateless/00910_zookeeper_custom_compression_codecs_replicated.sql @@ -1,4 +1,5 @@ SET send_logs_level = 'none'; +SET allow_suspicious_codecs = 1; DROP TABLE IF EXISTS test.compression_codec_replicated1; DROP TABLE IF EXISTS test.compression_codec_replicated2; diff --git a/tests/queries/0_stateless/00910_zookeeper_test_alter_compression_codecs.sql b/tests/queries/0_stateless/00910_zookeeper_test_alter_compression_codecs.sql index d9ca0595fa5..cec9ff86cd0 100644 --- a/tests/queries/0_stateless/00910_zookeeper_test_alter_compression_codecs.sql +++ b/tests/queries/0_stateless/00910_zookeeper_test_alter_compression_codecs.sql @@ -46,6 +46,7 @@ SYSTEM SYNC REPLICA alter_compression_codec1; SELECT * FROM alter_compression_codec1 ORDER BY id; SELECT * FROM alter_compression_codec2 ORDER BY id; +SET allow_suspicious_codecs = 1; ALTER TABLE alter_compression_codec1 MODIFY COLUMN alter_column CODEC(ZSTD, LZ4HC, LZ4, LZ4, NONE); SYSTEM SYNC REPLICA alter_compression_codec1; SYSTEM SYNC REPLICA alter_compression_codec2; diff --git a/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql b/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql index e79731edad7..53e640a4032 100644 --- a/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql +++ b/tests/queries/0_stateless/00926_adaptive_index_granularity_pk.sql @@ -57,6 +57,7 @@ SET force_primary_key = 0; DROP TABLE IF EXISTS large_alter_table_00926; DROP TABLE IF EXISTS store_of_hash_00926; +SET allow_suspicious_codecs = 1; CREATE TABLE large_alter_table_00926 ( somedate Date CODEC(ZSTD, ZSTD, ZSTD(12), LZ4HC(12)), id UInt64 CODEC(LZ4, ZSTD, NONE, LZ4HC), diff --git a/tests/queries/0_stateless/00957_delta_diff_bug.sql b/tests/queries/0_stateless/00957_delta_diff_bug.sql index 0c5fb6ce7e1..86584d3cdf3 100644 --- a/tests/queries/0_stateless/00957_delta_diff_bug.sql +++ b/tests/queries/0_stateless/00957_delta_diff_bug.sql @@ -1,3 +1,5 @@ +SET allow_suspicious_codecs = 1; + DROP TABLE IF EXISTS segfault_table; CREATE TABLE segfault_table (id UInt16 CODEC(Delta(2))) ENGINE MergeTree() order by tuple();