jasperjiaguo commented on code in PR #9420:
URL: https://github.com/apache/pinot/pull/9420#discussion_r980779413
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/dociditerators/MVScanDocIdIterator.java:
##########
@@ -104,6 +108,28 @@ public long getNumEntriesScanned() {
return _numEntriesScanned;
}
+ /**
+ * This is a crude version of
+ *
org.apache.pinot.controller.recommender.rules.utils.QueryInvertedSortedIndexRecommender#percentSelected
+ */
+ @Override
+ public float getEffectiveCardinality(boolean isAndDocIdSet) {
+ float numMatchingItems = _predicateEvaluator.getNumMatchingItems();
+ if (Float.isNaN(numMatchingItems) || _cardinality < 0) {
+ return
ScanBasedDocIdIterator.super.getEffectiveCardinality(isAndDocIdSet);
+ }
+ int avgNumValuesPerMVEntry = _maxNumValuesPerMVEntry < 0
+ ? OptimizationConstants.DEFAULT_AVG_MV_ENTRIES
+ : _maxNumValuesPerMVEntry /
OptimizationConstants.DEFAULT_AVG_MV_ENTRIES_DENOMINATOR;
+
+ numMatchingItems = numMatchingItems > 0 ? numMatchingItems *
avgNumValuesPerMVEntry
+ : (numMatchingItems * avgNumValuesPerMVEntry + _cardinality);
+
+ numMatchingItems = Math.max(Math.min(_cardinality, numMatchingItems), 0);
+
+ return _cardinality / numMatchingItems;
Review Comment:
_cardinality will be nonzero float, so div by 0 will be positive infinity,
as is meaningful to the ranking.
--
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]