Skip to content

Commit

Permalink
Add specific statistic
Browse files Browse the repository at this point in the history
  • Loading branch information
alephonea committed Apr 19, 2024
1 parent 3fa1fe2 commit 27ad45d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ydb/library/yql/core/yql_statistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ enum EStatisticsType : ui32 {
ManyManyJoin
};

// Providers may subclass this struct to associate specific statistics, useful to
// derive stats for higher-level operators in the plan.
struct IProviderStatistics {
virtual ~IProviderStatistics() {}
};

/**
* Optimizer Statistics struct records per-table and per-column statistics
* for the current operator in the plan. Currently, only Nrows and Ncols are
Expand All @@ -28,6 +34,7 @@ struct TOptimizerStatistics {
double Cost = 0;
double Selectivity = 1.0;
const TVector<TString>& KeyColumns;
const IProviderStatistics* Specific = nullptr;

TOptimizerStatistics() : KeyColumns(EmptyColumns) {}
TOptimizerStatistics(double nrows, int ncols): Nrows(nrows), Ncols(ncols), KeyColumns(EmptyColumns) {}
Expand All @@ -36,6 +43,8 @@ struct TOptimizerStatistics {
TOptimizerStatistics(EStatisticsType type, double nrows, int ncols, double byteSize, double cost): Type(type), Nrows(nrows), Ncols(ncols), ByteSize(byteSize), Cost(cost), KeyColumns(EmptyColumns) {}
TOptimizerStatistics(EStatisticsType type, double nrows, int ncols, double cost, const TVector<TString>& keyColumns): Type(type), Nrows(nrows), Ncols(ncols), Cost(cost), KeyColumns(keyColumns) {}
TOptimizerStatistics(EStatisticsType type, double nrows, int ncols, double byteSize, double cost, const TVector<TString>& keyColumns): Type(type), Nrows(nrows), Ncols(ncols), ByteSize(byteSize), Cost(cost), KeyColumns(keyColumns) {}
TOptimizerStatistics(EStatisticsType type, double nrows, int ncols, double byteSize, double cost, const TVector<TString>& keyColumns, IProviderStatistics* specific)
: Type(type), Nrows(nrows), Ncols(ncols), ByteSize(byteSize), Cost(cost), KeyColumns(keyColumns), Specific(specific) {}

TOptimizerStatistics& operator+=(const TOptimizerStatistics& other);
bool Empty() const;
Expand Down

0 comments on commit 27ad45d

Please sign in to comment.