File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -985,15 +985,15 @@ std::string QueryAnalyzer::rewriteAggregateFunctionNameIfNeeded(
985985 {
986986 result_aggregate_function_name = settings.count_distinct_implementation ;
987987 }
988- else if (aggregate_function_name_lowercase == " countdistinctif" || aggregate_function_name_lowercase == " countifdistinct" )
988+ else if (settings.rewrite_count_distinct_if_with_count_distinct_implementation &&
989+ (aggregate_function_name_lowercase == " countdistinctif" || aggregate_function_name_lowercase == " countifdistinct" ))
989990 {
990991 result_aggregate_function_name = settings.count_distinct_implementation ;
991992 result_aggregate_function_name += " If" ;
992993 }
993-
994- // / Replace aggregateFunctionIfDistinct into aggregateFunctionDistinctIf to make execution more optimal
995- if (aggregate_function_name_lowercase.ends_with (" ifdistinct" ))
994+ else if (aggregate_function_name_lowercase.ends_with (" ifdistinct" ))
996995 {
996+ // / Replace aggregateFunctionIfDistinct into aggregateFunctionDistinctIf to make execution more optimal
997997 size_t prefix_length = result_aggregate_function_name.size () - strlen (" ifdistinct" );
998998 result_aggregate_function_name = result_aggregate_function_name.substr (0 , prefix_length) + " DistinctIf" ;
999999 }
You can’t perform that action at this time.
0 commit comments