ClickHouse/src/Interpreters/IKeyValueEntity.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.4 KiB
C++
Raw Normal View History

2022-01-21 05:36:36 +00:00
#pragma once
2024-03-19 16:04:29 +00:00
#include <Core/Block.h>
2022-07-04 17:10:34 +00:00
#include <Core/Names.h>
2022-07-04 13:19:46 +00:00
#include <Processors/Chunk.h>
2022-01-21 05:36:36 +00:00
namespace DB
{
/// Interface for entities with key-value semantics.
class IKeyValueEntity
2022-01-21 05:36:36 +00:00
{
public:
2022-08-08 10:58:28 +00:00
IKeyValueEntity() = default;
virtual ~IKeyValueEntity() = default;
2022-07-04 17:10:34 +00:00
/// Get primary key name that supports key-value requests.
/// Primary key can constist of multiple columns.
virtual Names getPrimaryKey() const = 0;
2022-01-21 05:36:36 +00:00
2022-07-04 17:10:34 +00:00
/*
* Get data from storage directly by keys.
*
* @param keys - keys to get data for. Key can be compound and represented by several columns.
* @param out_null_map - output parameter indicating which keys were not found.
2022-08-08 10:58:28 +00:00
* @param required_columns - if we don't need all attributes, implementation can use it to benefit from reading a subset of them.
2022-07-04 17:10:34 +00:00
*
* @return - chunk of data corresponding for keys.
* Number of rows in chunk is equal to size of columns in keys.
* If the key was not found row would have a default value.
*/
2022-08-08 10:58:28 +00:00
virtual Chunk getByKeys(const ColumnsWithTypeAndName & keys, PaddedPODArray<UInt8> & out_null_map, const Names & required_columns) const = 0;
/// Header for getByKeys result
2022-08-08 10:58:28 +00:00
virtual Block getSampleBlock(const Names & required_columns) const = 0;
2022-08-08 10:58:28 +00:00
protected:
/// Names of result columns. If empty then all columns are required.
Names key_value_result_names;
2022-01-21 05:36:36 +00:00
};
}