summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/ce/ce_test_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/ce/ce_test_utils.h')
-rw-r--r--src/mongo/db/query/ce/ce_test_utils.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mongo/db/query/ce/ce_test_utils.h b/src/mongo/db/query/ce/ce_test_utils.h
index 667a3b70dc3..9e6ebdeb5e8 100644
--- a/src/mongo/db/query/ce/ce_test_utils.h
+++ b/src/mongo/db/query/ce/ce_test_utils.h
@@ -32,6 +32,7 @@
#include <cstddef>
#include <sys/types.h>
+#include "mongo/db/query/ce/histogram_estimation.h"
#include "mongo/db/query/ce/scalar_histogram.h"
#include "mongo/db/query/optimizer/cascades/interfaces.h"
#include "mongo/db/query/optimizer/opt_phase_manager.h"
@@ -71,14 +72,15 @@ const OptPhaseManager::PhaseSet kNoOptPhaseSet{};
* expecting.
*/
-#define _ASSERT_MATCH_CE(ce, predicate, expectedCE) \
- if constexpr (kCETestLogOnly) { \
- if (std::abs(ce.getCE(predicate) - expectedCE) > kMaxCEError) { \
- std::cout << "ERROR: expected " << expectedCE << std::endl; \
- } \
- ASSERT_APPROX_EQUAL(1.0, 1.0, kMaxCEError); \
- } else { \
- ASSERT_APPROX_EQUAL(expectedCE, ce.getCE(predicate), kMaxCEError); \
+#define _ASSERT_MATCH_CE(ce, predicate, expectedCE) \
+ if constexpr (kCETestLogOnly) { \
+ if (std::abs(ce.getCE(predicate) - expectedCE) > kMaxCEError) { \
+ std::cout << "ERROR: cardinality " << ce.getCE(predicate) << " expected " \
+ << expectedCE << std::endl; \
+ } \
+ ASSERT_APPROX_EQUAL(1.0, 1.0, kMaxCEError); \
+ } else { \
+ ASSERT_APPROX_EQUAL(expectedCE, ce.getCE(predicate), kMaxCEError); \
}
#define _PREDICATE(field, predicate) (str::stream() << "{" << field << ": " << predicate "}")
#define _ELEMMATCH_PREDICATE(field, predicate) \
@@ -159,5 +161,7 @@ struct BucketData {
ScalarHistogram createHistogram(const std::vector<BucketData>& data);
+double estimateIntValCard(const ScalarHistogram& hist, int v, EstimationType type);
+
} // namespace ce
} // namespace mongo