From 6cd8bec3fc0fb1b4a01c2779bc8031f9ea6eed26 Mon Sep 17 00:00:00 2001 From: Francisco Javier Jurado Moreno <9376816+Beetelbrox@users.noreply.github.com> Date: Thu, 23 May 2024 15:31:56 +0200 Subject: [PATCH] Remove unnecessary repetition --- src/Functions/FunctionsComparison.h | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/Functions/FunctionsComparison.h b/src/Functions/FunctionsComparison.h index 777404d2594..0da9b6aadf0 100644 --- a/src/Functions/FunctionsComparison.h +++ b/src/Functions/FunctionsComparison.h @@ -1324,10 +1324,13 @@ public: { return res; } - else if (((left_is_ipv6 && right_is_fixed_string) || (right_is_ipv6 && left_is_fixed_string)) && fixed_string_size == IPV6_BINARY_LENGTH) + else if ( + (((left_is_ipv6 && right_is_fixed_string) || (right_is_ipv6 && left_is_fixed_string)) && fixed_string_size == IPV6_BINARY_LENGTH) + || ((left_is_ipv4 || left_is_ipv6) && (right_is_ipv4 || right_is_ipv6)) + ) { - /// Special treatment for FixedString(16) as a binary representation of IPv6 - - /// CAST is customized for this case + /// Special treatment for FixedString(16) as a binary representation of IPv6 & for comparing IPv4 & IPv6 values - + /// CAST is customized for this cases ColumnPtr left_column = left_is_ipv6 ? col_with_type_and_name_left.column : castColumn(col_with_type_and_name_left, right_type); ColumnPtr right_column = right_is_ipv6 ? @@ -1335,15 +1338,6 @@ public: return executeGenericIdenticalTypes(left_column.get(), right_column.get()); } - else if ((left_is_ipv4 || left_is_ipv6) && (right_is_ipv4 || right_is_ipv6)) - { - ColumnPtr left_column = left_is_ipv6 ? - col_with_type_and_name_left.column : castColumn(col_with_type_and_name_left, right_type); - ColumnPtr right_column = right_is_ipv6 ? - col_with_type_and_name_right.column : castColumn(col_with_type_and_name_right, left_type); - - return executeGenericIdenticalTypes(left_column.get(), right_column.get()); - } else if ((isColumnedAsDecimal(left_type) || isColumnedAsDecimal(right_type))) { // Comparing Date/Date32 and DateTime64 requires implicit conversion,