v.23.2Improvement

Fix NaN Handling in Welch and Student T-Test Functions

Fix assertion in the welchTTest function in debug build when the resulting statistics is NaN. Unified the behavior with other similar functions. Change the behavior of studentTTest to return NaN instead of throwing an exception because the previous behavior was inconvenient. This closes #41176 This closes #42162. #46141 (Alexey Milovidov).
Fixed assertion in the welchTTest function for NaN results and unified behavior of statistical test functions by making studentTTest return NaN instead of throwing exceptions.

Why it matters

To improve the robustness and consistency of statistical test functions in ClickHouse by handling cases where computations result in NaN values gracefully instead of failing with exceptions. This makes the behavior of studentTTest uniform with welchTTest and other similar functions, avoiding inconvenient crashes during data analysis.

How to use it

Users automatically benefit from this fix after updating to the new version. The behavior change means that when studentTTest or welchTTest produce NaN as a statistical result, the function will return NaN without throwing exceptions, allowing queries to proceed smoothly. No additional configuration is needed.