greenplumn CLimitStatsProcessor 源码

  • 2022-08-18
  • 浏览 (50)

greenplumn CLimitStatsProcessor 代码


//	Greenplum Database
//	Copyright 2018 VMware, Inc. or its affiliates.
//	@filename:
//		CLimitStatsProcessor.cpp
//	@doc:
//		Statistics helper routines for processing limit operations

#include "naucrates/statistics/CLimitStatsProcessor.h"

using namespace gpopt;

//	compute the statistics of a limit operation
CStatistics *
CLimitStatsProcessor::CalcLimitStats(CMemoryPool *mp,
									 const CStatistics *input_stats,
									 CDouble input_limit_rows)
	GPOS_ASSERT(nullptr != input_stats);

	// copy the hash map from colid -> histogram for resultant structure
	UlongToHistogramMap *colid_histogram = input_stats->CopyHistograms(mp);

	CDouble limit_rows = CStatistics::MinRows;
	if (!input_stats->IsEmpty())
		limit_rows = std::max(CStatistics::MinRows, input_limit_rows);
	// create an output stats object
	CStatistics *pstatsLimit = GPOS_NEW(mp) CStatistics(
		mp, colid_histogram, input_stats->CopyWidths(mp), limit_rows,
		input_stats->IsEmpty(), input_stats->GetNumberOfPredicates());

	// In the output statistics object, the upper bound source cardinality of the join column
	// cannot be greater than the upper bound source cardinality information maintained in the input
	// statistics object. Therefore we choose CStatistics::EcbmMin the bounding method which takes
	// the minimum of the cardinality upper bound of the source column (in the input hash map)
	// and estimated limit cardinality.

	// modify source id to upper bound card information
		mp, input_stats, pstatsLimit, limit_rows,
		CStatistics::EcbmMin /* card_bounding_method */);

	return pstatsLimit;

// EOF


greenplumn 源码目录


greenplumn CBucket 源码

greenplumn CFilterStatsProcessor 源码

greenplumn CGroupByStatsProcessor 源码

greenplumn CHistogram 源码

greenplumn CInnerJoinStatsProcessor 源码

greenplumn CJoinStatsProcessor 源码

greenplumn CLeftAntiSemiJoinStatsProcessor 源码

greenplumn CLeftOuterJoinStatsProcessor 源码

greenplumn CLeftSemiJoinStatsProcessor 源码

greenplumn CPoint 源码

0  赞