@@ -446,33 +446,7 @@ void ASTFunction::formatImplWithoutAlias(WriteBuffer & ostr, const FormatSetting
446446 arguments->children [0 ]->format (ostr, settings, state, nested_need_parens);
447447 ostr << it->operator_name ;
448448
449- // / Format x IN 1 as x IN (1): put parens around rhs even if there is a single element in set.
450- const auto * second_arg_func = arguments->children [1 ]->as <ASTFunction>();
451- const auto * second_arg_literal = arguments->children [1 ]->as <ASTLiteral>();
452- bool is_literal_tuple_or_array = second_arg_literal
453- && (second_arg_literal->value .getType () == Field::Types::Tuple
454- || second_arg_literal->value .getType () == Field::Types::Array);
455-
456- /* * Conditions for extra parens:
457- * 1. Is IN operator
458- * 2. 2nd arg is not subquery, function, or literal tuple or array
459- * 3. If the 2nd argument has alias, we ignore condition 2 and add extra parens
460- *
461- * Condition 3 is needed to avoid inconsistency in format-parse-format debug check in executeQuery.cpp
462- */
463- bool extra_parents_around_in_rhs = is_in_operator
464- && ((!arguments->children [1 ]->as <ASTSubquery>() && !second_arg_func && !is_literal_tuple_or_array)
465- || !arguments->children [1 ]->tryGetAlias ().empty ());
466-
467- if (extra_parents_around_in_rhs)
468- {
469- ostr << ' (' ;
470- arguments->children [1 ]->format (ostr, settings, state, nested_dont_need_parens);
471- ostr << ' )' ;
472- }
473-
474- if (!extra_parents_around_in_rhs)
475- arguments->children [1 ]->format (ostr, settings, state, nested_need_parens);
449+ arguments->children [1 ]->format (ostr, settings, state, nested_need_parens);
476450
477451 if (need_parens_around_in)
478452 ostr << ' )' ;
0 commit comments