Waloid24 commented on code in PR #2007:
URL: https://github.com/apache/cloudberry/pull/2007#discussion_r4035254034
##########
src/backend/gporca/libnaucrates/src/statistics/CScaleFactorUtils.cpp:
##########
@@ -502,12 +502,25 @@ CScaleFactorUtils::CalcScaleFactorCumulativeConj(
const ULONG num_cols = scale_factors->Size();
CDouble scale_factor(1.0);
+ if (0 == num_cols)
+ {
+ return scale_factor;
+ }
+
if (1 < num_cols)
{
// sort (in desc order) the scaling factor based on the
selectivity of each column
scale_factors->Sort(CScaleFactorUtils::DescendingOrderCmpFunc);
}
+ if (CDouble(0.0) == stats_config->DDampingFactorFilter())
Review Comment:
Right, the comment "Handle zero explicitly rather than relying on CDouble's
minimum magnitude when computing powers" is excessive.
But can we keep this branch as a quick way to return from the function to
avoid the (unnecessary in this situation) loop below?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]