v.23.2Improvement
Fix NaN Handling in Welch and Student T-Test Functions
Fix assertion in thewelchTTestfunction in debug build when the resulting statistics is NaN. Unified the behavior with other similar functions. Change the behavior ofstudentTTestto return NaN instead of throwing an exception because the previous behavior was inconvenient. This closes #41176 This closes #42162. #46141 (Alexey Milovidov).
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 ofstudentTTest 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 whenstudentTTest 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.