forked from alibaba/paimon-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtable_read.h
More file actions
70 lines (60 loc) · 2.44 KB
/
table_read.h
File metadata and controls
70 lines (60 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright 2024-present Alibaba Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include <vector>
#include "paimon/executor.h"
#include "paimon/memory/memory_pool.h"
#include "paimon/read_context.h"
#include "paimon/reader/batch_reader.h"
#include "paimon/result.h"
#include "paimon/table/source/split.h"
#include "paimon/visibility.h"
namespace paimon {
class MemoryPool;
class ReadContext;
/// Given a `Split` or a list of `Split`, generate a reader for batch reading.
class PAIMON_EXPORT TableRead {
public:
virtual ~TableRead() = default;
/// Create an instance of `TableRead`.
///
/// @param context A unique pointer to the `ReadContext` used for read operations.
/// @return A Result containing a unique pointer to the `TableRead` instance.
static Result<std::unique_ptr<TableRead>> Create(std::unique_ptr<ReadContext> context);
/// Creates a `BatchReader` instance for reading data.
///
/// This method creates a BatchReader that will be responsible for reading data from the
/// provided splits.
///
/// @param splits A vector of shared pointers to `Split` instances representing the
/// data to be read.
/// @return A Result containing a unique pointer to the `BatchReader` instance.
virtual Result<std::unique_ptr<BatchReader>> CreateReader(
const std::vector<std::shared_ptr<Split>>& splits);
/// Creates a `BatchReader` instance for a single split.
///
/// @param split A shared pointer to the `Split` instance that defines the data to be
/// read.
/// @return A Result containing a unique pointer to the `BatchReader` instance.
virtual Result<std::unique_ptr<BatchReader>> CreateReader(
const std::shared_ptr<Split>& split) = 0;
protected:
explicit TableRead(const std::shared_ptr<MemoryPool>& memory_pool);
private:
std::shared_ptr<MemoryPool> pool_;
};
} // namespace paimon