ClickHouse/src/Dictionaries/DictionarySourceHelpers.h

56 lines
1.3 KiB
C++
Raw Normal View History

2017-05-25 19:21:57 +00:00
#pragma once
#include <vector>
#include <common/types.h>
#include <Poco/Util/AbstractConfiguration.h>
#include <Processors/ISimpleTransform.h>
#include <Columns/IColumn.h>
#include <Core/Block.h>
#include <Interpreters/Context_fwd.h>
2021-05-28 18:17:16 +00:00
2017-05-25 19:21:57 +00:00
namespace DB
{
2021-02-28 21:04:05 +00:00
2017-05-25 19:21:57 +00:00
struct DictionaryStructure;
2017-05-25 19:21:57 +00:00
/// For simple key
2021-01-27 13:23:02 +00:00
Block blockForIds(
const DictionaryStructure & dict_struct,
const std::vector<UInt64> & ids);
2017-05-25 19:21:57 +00:00
/// For composite key
Block blockForKeys(
const DictionaryStructure & dict_struct,
const Columns & key_columns,
const std::vector<size_t> & requested_rows);
2017-05-25 19:21:57 +00:00
/// Used for applying settings to copied context in some register[...]Source functions
2021-05-31 14:49:02 +00:00
ContextMutablePtr copyContextAndApplySettings(
2020-04-09 20:52:53 +00:00
const std::string & config_prefix,
2021-06-01 12:20:52 +00:00
ContextPtr context,
2020-04-17 19:54:53 +00:00
const Poco::Util::AbstractConfiguration & config);
2021-02-28 21:04:05 +00:00
/** A stream, adds additional columns to each block that it will read from inner stream.
*
* block_to_add rows size must be equal to final sum rows size of all inner stream blocks.
*/
class TransformWithAdditionalColumns final : public ISimpleTransform
2021-02-28 21:04:05 +00:00
{
public:
TransformWithAdditionalColumns(Block block_to_add_, const Block & header);
2021-02-28 21:04:05 +00:00
void transform(Chunk & chunk) override;
2021-02-28 21:04:05 +00:00
String getName() const override;
private:
Block block_to_add;
size_t current_range_index = 0;
};
}