use of org.apache.ignite.internal.processors.query.stat.messages.StatisticsColumnData in project ignite by apache.
the class StatisticsUtils method toMessage.
/**
* Convert ColumnStatistics to StaticColumnData message.
*
* @param stat Column statistics to convert.
* @return Converted stats column data message.
* @throws IgniteCheckedException In case of errors.
*/
public static StatisticsColumnData toMessage(ColumnStatistics stat) throws IgniteCheckedException {
GridH2ValueMessage msgMin = stat.min() == null ? null : GridH2ValueMessageFactory.toMessage(stat.min());
GridH2ValueMessage msgMax = stat.max() == null ? null : GridH2ValueMessageFactory.toMessage(stat.max());
return new StatisticsColumnData(msgMin, msgMax, stat.nulls(), stat.distinct(), stat.total(), stat.size(), stat.raw(), stat.version(), stat.createdAt());
}
use of org.apache.ignite.internal.processors.query.stat.messages.StatisticsColumnData in project ignite by apache.
the class StatisticsUtils method toObjectData.
/**
* Build statistics object data from values.
*
* @param keyMsg Statistics key.
* @param type Statistics type.
* @param stat Object statistics to convert.
* @return Converted StatsObjectData message.
* @throws IgniteCheckedException In case of errors.
*/
public static StatisticsObjectData toObjectData(StatisticsKeyMessage keyMsg, StatisticsType type, ObjectStatisticsImpl stat) throws IgniteCheckedException {
Map<String, StatisticsColumnData> colData = new HashMap<>(stat.columnsStatistics().size());
for (Map.Entry<String, ColumnStatistics> ts : stat.columnsStatistics().entrySet()) colData.put(ts.getKey(), toMessage(ts.getValue()));
StatisticsObjectData data;
if (stat instanceof ObjectPartitionStatisticsImpl) {
ObjectPartitionStatisticsImpl partStats = (ObjectPartitionStatisticsImpl) stat;
data = new StatisticsObjectData(keyMsg, stat.rowCount(), type, partStats.partId(), partStats.updCnt(), colData);
} else
data = new StatisticsObjectData(keyMsg, stat.rowCount(), type, 0, 0, colData);
return data;
}
Aggregations