We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6dab43a commit 0b09604Copy full SHA for 0b09604
velox/functions/prestosql/aggregates/CovarianceAggregates.cpp
@@ -236,9 +236,8 @@ struct CorrResultAccessor {
236
}
237
238
static double result(const CorrAccumulator& accumulator) {
239
- double stddevX = std::sqrt(accumulator.m2X());
240
- double stddevY = std::sqrt(accumulator.m2Y());
241
- return accumulator.c2() / stddevX / stddevY;
+ // Modify the calculation order to maintain the same accuracy with spark.
+ return accumulator.c2() / std::sqrt(accumulator.m2X() * accumulator.m2Y());
242
243
};
244
0 commit comments