dispatcher
| 211 | |
| 212 | // dispatcher |
| 213 | CachedStatsProxyPtr createCachedStatsProxy(const CatalogAdaptorPtr & catalog, StatisticsCachePolicy policy) |
| 214 | { |
| 215 | // when enable_memory_catalog is true, we won't use cache |
| 216 | if (catalog->getSettingsRef().enable_memory_catalog) |
| 217 | { |
| 218 | if (policy != StatisticsCachePolicy::Default) |
| 219 | throw Exception("memory catalog don't support cache policy", ErrorCodes::BAD_ARGUMENTS); |
| 220 | |
| 221 | return std::make_unique<CachedStatsProxyDirectImpl>(catalog); |
| 222 | } |
| 223 | |
| 224 | if (policy == StatisticsCachePolicy::Default) |
| 225 | { |
| 226 | return std::make_unique<CachedStatsProxyImpl<false>>(catalog); |
| 227 | } |
| 228 | else if (policy == StatisticsCachePolicy::Catalog) |
| 229 | { |
| 230 | return std::make_unique<CachedStatsProxyDirectImpl>(catalog); |
| 231 | } |
| 232 | else if (policy == StatisticsCachePolicy::Cache) |
| 233 | { |
| 234 | return std::make_unique<CachedStatsProxyImpl<true>>(catalog); |
| 235 | } |
| 236 | else |
| 237 | { |
| 238 | throw Exception("Unknown statistics cache policy", ErrorCodes::LOGICAL_ERROR); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | |
| 243 | } // namespace DB |
no test coverage detected