From 1ea6bc969103aeba26e345b7108b76d499fc72c6 Mon Sep 17 00:00:00 2001 From: chertus Date: Tue, 4 Sep 2018 18:04:23 +0300 Subject: [PATCH] decimal_check_overflow [CLICKHOUSE-3765] --- dbms/src/DataTypes/DataTypesDecimal.cpp | 4 ++-- dbms/src/Interpreters/Settings.h | 3 +-- dbms/tests/queries/0_stateless/00700_decimal_arithm.sql | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/dbms/src/DataTypes/DataTypesDecimal.cpp b/dbms/src/DataTypes/DataTypesDecimal.cpp index 5e78c980848..9f81107eb68 100644 --- a/dbms/src/DataTypes/DataTypesDecimal.cpp +++ b/dbms/src/DataTypes/DataTypesDecimal.cpp @@ -20,8 +20,8 @@ namespace ErrorCodes } -bool decimalCheckComparisonOverflow(const Context & context) { return context.getSettingsRef().decimal_check_comparison_overflow; } -bool decimalCheckArithmeticOverflow(const Context & context) { return context.getSettingsRef().decimal_check_arithmetic_overflow; } +bool decimalCheckComparisonOverflow(const Context & context) { return context.getSettingsRef().decimal_check_overflow; } +bool decimalCheckArithmeticOverflow(const Context & context) { return context.getSettingsRef().decimal_check_overflow; } // diff --git a/dbms/src/Interpreters/Settings.h b/dbms/src/Interpreters/Settings.h index d2afd5bb036..da3b7364d36 100644 --- a/dbms/src/Interpreters/Settings.h +++ b/dbms/src/Interpreters/Settings.h @@ -281,8 +281,7 @@ struct Settings M(SettingBool, low_cardinality_use_single_dictionary_for_part, false, "LowCardinality type serialization setting. If is true, than will use additional keys when global dictionary overflows. Otherwise, will create several shared dictionaries.") \ M(SettingBool, allow_experimental_low_cardinality_type, false, "Allows to create table with LowCardinality types.") \ M(SettingBool, allow_experimental_decimal_type, false, "Enables Decimal data type.") \ - M(SettingBool, decimal_check_comparison_overflow, true, "Check overflow of decimal comparison operations") \ - M(SettingBool, decimal_check_arithmetic_overflow, true, "Check overflow of decimal arithmetic operations") \ + M(SettingBool, decimal_check_overflow, true, "Check overflow of decimal arithmetic/comparison operations") \ \ M(SettingBool, prefer_localhost_replica, 1, "1 - always send query to local replica, if it exists. 0 - choose replica to send query between local and remote ones according to load_balancing") \ M(SettingUInt64, max_fetch_partition_retries_count, 5, "Amount of retries while fetching partition from another host.") \ diff --git a/dbms/tests/queries/0_stateless/00700_decimal_arithm.sql b/dbms/tests/queries/0_stateless/00700_decimal_arithm.sql index f0802b7e83a..7ebd189b690 100644 --- a/dbms/tests/queries/0_stateless/00700_decimal_arithm.sql +++ b/dbms/tests/queries/0_stateless/00700_decimal_arithm.sql @@ -58,7 +58,7 @@ SELECT 21 + j, 21 - j, 84 - j, 21 * j, -21 * j, 21 / j, 84 / j FROM test.decimal SELECT a, -a, -b, -c, -d, -e, -f, -g, -h, -j from test.decimal ORDER BY a; SELECT abs(a), abs(b), abs(c), abs(d), abs(e), abs(f), abs(g), abs(h), abs(j) from test.decimal ORDER BY a; -SET decimal_check_arithmetic_overflow = 0; +SET decimal_check_overflow = 0; SELECT (h * h) != 0, (h / h) != 1 FROM test.decimal WHERE h > 0; SELECT (i * i) != 0, (i / i) = 1 FROM test.decimal WHERE i > 0;