2017-09-05 01:08:26 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-12-10 15:25:45 +00:00
|
|
|
#include <Common/SharedLibrary.h>
|
2021-03-12 21:12:34 +00:00
|
|
|
#include <Bridge/LibraryBridgeHelper.h>
|
2018-12-10 15:25:45 +00:00
|
|
|
#include <common/LocalDateTime.h>
|
2021-03-22 14:39:17 +00:00
|
|
|
#include <Core/UUID.h>
|
2018-11-28 11:37:12 +00:00
|
|
|
#include "DictionaryStructure.h"
|
2019-02-15 11:46:07 +00:00
|
|
|
#include <Core/ExternalResultDescription.h>
|
2018-11-28 11:37:12 +00:00
|
|
|
#include "IDictionarySource.h"
|
2021-04-10 23:33:54 +00:00
|
|
|
#include <Interpreters/Context_fwd.h>
|
2017-09-05 01:08:26 +00:00
|
|
|
|
2017-09-07 21:04:48 +00:00
|
|
|
|
2017-09-05 01:08:26 +00:00
|
|
|
namespace Poco
|
|
|
|
{
|
2018-03-13 23:13:39 +00:00
|
|
|
class Logger;
|
2017-12-09 06:32:22 +00:00
|
|
|
|
2018-03-13 23:13:39 +00:00
|
|
|
namespace Util
|
|
|
|
{
|
|
|
|
class AbstractConfiguration;
|
|
|
|
}
|
2017-09-05 01:08:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2021-03-05 09:38:00 +00:00
|
|
|
|
2020-02-25 18:10:48 +00:00
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int NOT_IMPLEMENTED;
|
|
|
|
}
|
2021-03-05 09:38:00 +00:00
|
|
|
|
2017-09-05 17:13:00 +00:00
|
|
|
class CStringsHolder;
|
2021-03-05 09:38:00 +00:00
|
|
|
using LibraryBridgeHelperPtr = std::shared_ptr<LibraryBridgeHelper>;
|
2017-09-05 01:08:26 +00:00
|
|
|
|
|
|
|
class LibraryDictionarySource final : public IDictionarySource
|
|
|
|
{
|
|
|
|
public:
|
2018-12-10 15:25:45 +00:00
|
|
|
LibraryDictionarySource(
|
|
|
|
const DictionaryStructure & dict_struct_,
|
2017-09-05 01:08:26 +00:00
|
|
|
const Poco::Util::AbstractConfiguration & config,
|
2019-08-03 11:02:40 +00:00
|
|
|
const std::string & config_prefix_,
|
2019-12-10 17:27:29 +00:00
|
|
|
Block & sample_block_,
|
2021-04-10 23:33:54 +00:00
|
|
|
ContextPtr context_,
|
2019-12-10 17:27:29 +00:00
|
|
|
bool check_config);
|
2017-09-05 01:08:26 +00:00
|
|
|
|
|
|
|
LibraryDictionarySource(const LibraryDictionarySource & other);
|
2019-07-08 00:51:43 +00:00
|
|
|
LibraryDictionarySource & operator=(const LibraryDictionarySource &) = delete;
|
2017-09-05 01:08:26 +00:00
|
|
|
|
2018-06-03 20:39:06 +00:00
|
|
|
~LibraryDictionarySource() override;
|
2018-02-26 16:57:14 +00:00
|
|
|
|
2017-09-05 01:08:26 +00:00
|
|
|
BlockInputStreamPtr loadAll() override;
|
|
|
|
|
2018-02-15 13:08:23 +00:00
|
|
|
BlockInputStreamPtr loadUpdatedAll() override
|
|
|
|
{
|
2021-04-10 18:48:36 +00:00
|
|
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method loadUpdatedAll is unsupported for LibraryDictionarySource");
|
2018-02-15 13:08:23 +00:00
|
|
|
}
|
|
|
|
|
2017-09-05 01:08:26 +00:00
|
|
|
BlockInputStreamPtr loadIds(const std::vector<UInt64> & ids) override;
|
|
|
|
|
|
|
|
BlockInputStreamPtr loadKeys(const Columns & key_columns, const std::vector<std::size_t> & requested_rows) override;
|
|
|
|
|
|
|
|
bool isModified() const override;
|
|
|
|
|
|
|
|
bool supportsSelectiveLoad() const override;
|
|
|
|
|
2018-01-15 12:44:39 +00:00
|
|
|
///Not yet supported
|
2018-12-10 15:25:45 +00:00
|
|
|
bool hasUpdateField() const override { return false; }
|
2018-01-15 12:44:39 +00:00
|
|
|
|
2017-09-05 01:08:26 +00:00
|
|
|
DictionarySourcePtr clone() const override;
|
|
|
|
|
|
|
|
std::string toString() const override;
|
|
|
|
|
|
|
|
private:
|
2021-03-07 19:53:10 +00:00
|
|
|
static String getDictIdsString(const std::vector<UInt64> & ids);
|
|
|
|
|
2021-03-24 19:32:31 +00:00
|
|
|
String getDictAttributesString();
|
|
|
|
|
2021-03-07 19:53:10 +00:00
|
|
|
static String getLibrarySettingsString(const Poco::Util::AbstractConfiguration & config, const std::string & config_root);
|
2017-09-05 01:08:26 +00:00
|
|
|
|
2021-03-22 14:39:17 +00:00
|
|
|
static Field getDictID() { return UUIDHelpers::generateV4(); }
|
|
|
|
|
2021-03-05 09:38:00 +00:00
|
|
|
Poco::Logger * log;
|
|
|
|
|
2017-09-05 01:08:26 +00:00
|
|
|
const DictionaryStructure dict_struct;
|
|
|
|
const std::string config_prefix;
|
|
|
|
const std::string path;
|
2021-03-22 14:39:17 +00:00
|
|
|
const Field dictionary_id;
|
2021-03-05 09:38:00 +00:00
|
|
|
|
2017-09-05 01:08:26 +00:00
|
|
|
Block sample_block;
|
2021-04-10 23:33:54 +00:00
|
|
|
ContextPtr context;
|
2021-03-05 09:38:00 +00:00
|
|
|
|
|
|
|
LibraryBridgeHelperPtr bridge_helper;
|
2017-09-05 01:08:26 +00:00
|
|
|
ExternalResultDescription description;
|
|
|
|
};
|
2018-11-28 11:37:12 +00:00
|
|
|
|
2017-09-05 01:08:26 +00:00
|
|
|
}
|