mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 19:12:03 +00:00
495c6e03aa
* Replace all Context references with std::weak_ptr * Fix shared context captured by value * Fix build * Fix Context with named sessions * Fix copy context * Fix gcc build * Merge with master and fix build * Fix gcc-9 build
66 lines
1.5 KiB
C++
66 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <Interpreters/Context_fwd.h>
|
|
#include "IDictionary.h"
|
|
#include "registerDictionaries.h"
|
|
#include <Parsers/ASTCreateQuery.h>
|
|
|
|
|
|
namespace Poco
|
|
{
|
|
|
|
namespace Util
|
|
{
|
|
class AbstractConfiguration;
|
|
}
|
|
|
|
class Logger;
|
|
|
|
}
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Create dictionary according to its layout.
|
|
*/
|
|
class DictionaryFactory : private boost::noncopyable
|
|
{
|
|
public:
|
|
|
|
static DictionaryFactory & instance();
|
|
|
|
/// Create dictionary from AbstractConfiguration parsed
|
|
/// from xml-file on filesystem.
|
|
DictionaryPtr create(
|
|
const std::string & name,
|
|
const Poco::Util::AbstractConfiguration & config,
|
|
const std::string & config_prefix,
|
|
ContextPtr context,
|
|
bool check_source_config = false) const;
|
|
|
|
/// Create dictionary from DDL-query
|
|
DictionaryPtr create(const std::string & name,
|
|
const ASTCreateQuery & ast,
|
|
ContextPtr context) const;
|
|
|
|
using Creator = std::function<DictionaryPtr(
|
|
const std::string & name,
|
|
const DictionaryStructure & dict_struct,
|
|
const Poco::Util::AbstractConfiguration & config,
|
|
const std::string & config_prefix,
|
|
DictionarySourcePtr source_ptr)>;
|
|
|
|
bool isComplex(const std::string & layout_type) const;
|
|
|
|
void registerLayout(const std::string & layout_type, Creator create_layout, bool is_complex);
|
|
|
|
private:
|
|
using LayoutRegistry = std::unordered_map<std::string, Creator>;
|
|
LayoutRegistry registered_layouts;
|
|
using LayoutComplexity = std::unordered_map<std::string, bool>;
|
|
LayoutComplexity layout_complexity;
|
|
};
|
|
|
|
}
|