yangjiandan opened a new pull request, #5262: URL: https://github.com/apache/hive/pull/5262
### What changes were proposed in this pull request? when cbo is enable ``` STDDEV_SAMP(x) → SQRT( CASE WHEN ((SUM(x * x) - SUM(x) * SUM(x) / COUNT(x)) < 0) THEN 0 THEN (SUM(x * x) - SUM(x) * SUM(x) / COUNT(x)) / CASE COUNT(x) WHEN 1 THEN NULL ELSE COUNT(x) - 1 END) ``` ### Why are the changes needed? When the column type is double or decimal then SUM(x * x) and SUM(x) * SUM(x) / COUNT(x) values difference is coming negative value (very very small difference in fractional value) which is leading to NaN when applied SQRT(For more detailed info, see https://github.com/apache/hive/pull/4812) ### How was this patch tested? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org