You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-05 16:15:50 +03:00
feat(rbo,rules): refactored statistics storage in gwi and implemented statistics based UNION rewrite.
This commit is contained in:
@@ -136,10 +136,36 @@ namespace cal_impl_if
|
||||
{
|
||||
extern bool nonConstFunc(Item_func* ifp);
|
||||
|
||||
void gp_walk_info::mergeColumnStatisticsMap(const ColumnStatisticsMap& aColumnStatisticsMap)
|
||||
void gp_walk_info::mergeTableStatistics(const TableStatisticsMap& aTableStatisticsMap)
|
||||
{
|
||||
columnStatisticsMap.insert(aColumnStatisticsMap.begin(), aColumnStatisticsMap.end());
|
||||
for (auto& [schemaAndTableName, aColumnStatisticsMap]: aTableStatisticsMap)
|
||||
{
|
||||
auto tableStatisticsMapIt = tableStatisticsMap.find(schemaAndTableName);
|
||||
if (tableStatisticsMapIt == tableStatisticsMap.end())
|
||||
{
|
||||
tableStatisticsMap[schemaAndTableName] = aColumnStatisticsMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto& [columnName, histogram]: aColumnStatisticsMap)
|
||||
{
|
||||
tableStatisticsMapIt->second[columnName] = histogram;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<ColumnStatisticsMap> gp_walk_info::findStatisticsForATable(SchemaAndTableName& schemaAndTableName)
|
||||
{
|
||||
auto tableStatisticsMapIt = tableStatisticsMap.find(schemaAndTableName);
|
||||
if (tableStatisticsMapIt == tableStatisticsMap.end())
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return {tableStatisticsMapIt->second};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace
|
||||
|
Reference in New Issue
Block a user