Class IgniteStatisticsHelper
- java.lang.Object
-
- org.apache.ignite.internal.processors.query.stat.IgniteStatisticsHelper
-
public class IgniteStatisticsHelper extends Object
Utility methods to statistics messages generation.
-
-
Constructor Summary
Constructors Constructor Description IgniteStatisticsHelper(UUID locNodeId, SchemaManager schemaMgr, Function<Class<?>,IgniteLogger> logSupplier)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ObjectStatisticsImplaggregateLocalStatistics(GridQueryTypeDescriptor tbl, StatisticsObjectConfiguration cfg, Collection<? extends ObjectStatisticsImpl> stats, IgniteLogger log)Aggregate partition level statistics to local level one or local statistics to global one.ObjectStatisticsImplaggregateLocalStatistics(StatisticsObjectConfiguration cfg, Collection<? extends ObjectStatisticsImpl> stats)Aggregate specified partition level statistics to local level statistics.static StatisticsObjectConfiguration[]buildDefaultConfigurations(StatisticsTarget... targets)Build object configurations array with all default parameters from specified targets.static longcalculateRowCount(StatisticsObjectConfiguration cfg, long actualRowCnt)Calculate effective row count.static List<T2<Integer,String>>filterColumns(GridQueryTypeDescriptor typeDescriptor, @Nullable Collection<String> colNames)Filter columns by specified names.List<StatisticsAddressedRequest>generateGatheringRequests(StatisticsTarget target, StatisticsObjectConfiguration cfg)Generate local statistics requests.CacheGroupContextgroupContext(StatisticsKey key)Get cache group context by specified statistics key.
-
-
-
Constructor Detail
-
IgniteStatisticsHelper
public IgniteStatisticsHelper(UUID locNodeId, SchemaManager schemaMgr, Function<Class<?>,IgniteLogger> logSupplier)
Constructor.- Parameters:
locNodeId- Local node id.schemaMgr- Schema manager.logSupplier- Ignite logger supplier to get logger from.
-
-
Method Detail
-
groupContext
public CacheGroupContext groupContext(StatisticsKey key) throws IgniteCheckedException
Get cache group context by specified statistics key.- Parameters:
key- Statistics key to get context by.- Returns:
- Cache group context for the given key.
- Throws:
IgniteCheckedException- If unable to find table by specified key.
-
generateGatheringRequests
public List<StatisticsAddressedRequest> generateGatheringRequests(StatisticsTarget target, StatisticsObjectConfiguration cfg) throws IgniteCheckedException
Generate local statistics requests.- Parameters:
target- Statistics target to request local statistics by.cfg- Statistics configuration.- Returns:
- Collection of statistics request.
- Throws:
IgniteCheckedException
-
aggregateLocalStatistics
public ObjectStatisticsImpl aggregateLocalStatistics(StatisticsObjectConfiguration cfg, Collection<? extends ObjectStatisticsImpl> stats)
Aggregate specified partition level statistics to local level statistics.- Parameters:
cfg- Statistics object configuration.stats- Collection of all local partition level or local level statistics by specified key to aggregate.- Returns:
- Local level aggregated statistics.
-
aggregateLocalStatistics
public static ObjectStatisticsImpl aggregateLocalStatistics(GridQueryTypeDescriptor tbl, StatisticsObjectConfiguration cfg, Collection<? extends ObjectStatisticsImpl> stats, IgniteLogger log)
Aggregate partition level statistics to local level one or local statistics to global one.- Parameters:
tbl- Table to aggregate statistics by.cfg- Statistics object configuration.stats- Collection of partition level or local level statistics to aggregate.log- Logger.- Returns:
- Local level statistics.
-
calculateRowCount
public static long calculateRowCount(StatisticsObjectConfiguration cfg, long actualRowCnt)
Calculate effective row count. If there are some overrides in statistics configuration - maximum value will be choosen. If not - will returnactualRowCnt.- Parameters:
cfg- Statistics configuration to dig overrides row count from.actualRowCnt- Actual row count.- Returns:
- Effective row count.
-
buildDefaultConfigurations
public static StatisticsObjectConfiguration[] buildDefaultConfigurations(StatisticsTarget... targets)
Build object configurations array with all default parameters from specified targets.- Parameters:
targets- Targets to build configurations from.- Returns:
- StatisticsObjectConfiguration array.
-
filterColumns
public static List<T2<Integer,String>> filterColumns(GridQueryTypeDescriptor typeDescriptor, @Nullable @Nullable Collection<String> colNames)
Filter columns by specified names.- Parameters:
typeDescriptor- Table descriptor.colNames- Column names.- Returns:
- Column with specified names.
-
-