blob: 05a528b9c60d40edc43213731f058260e574edeb (
plain) (
blame)
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
71
72
73
74
75
76
|
#pragma once
#include "lenval_table_reader.h"
#include <yt/cpp/mapreduce/interface/io.h>
namespace NYT {
class TRawTableReader;
class TNodeTableReader;
////////////////////////////////////////////////////////////////////////////////
class TProtoTableReader
: public IProtoReaderImpl
{
public:
explicit TProtoTableReader(
::TIntrusivePtr<TRawTableReader> input,
TVector<const ::google::protobuf::Descriptor*>&& descriptors);
~TProtoTableReader() override;
void ReadRow(Message* row) override;
bool IsValid() const override;
void Next() override;
ui32 GetTableIndex() const override;
ui32 GetRangeIndex() const override;
ui64 GetRowIndex() const override;
void NextKey() override;
TMaybe<size_t> GetReadByteCount() const override;
bool IsEndOfStream() const override;
bool IsRawReaderExhausted() const override;
private:
THolder<TNodeTableReader> NodeReader_;
TVector<const ::google::protobuf::Descriptor*> Descriptors_;
};
////////////////////////////////////////////////////////////////////////////////
class TLenvalProtoTableReader
: public IProtoReaderImpl
, public TLenvalTableReader
{
public:
explicit TLenvalProtoTableReader(
::TIntrusivePtr<TRawTableReader> input,
TVector<const ::google::protobuf::Descriptor*>&& descriptors);
~TLenvalProtoTableReader() override;
void ReadRow(Message* row) override;
bool IsValid() const override;
void Next() override;
ui32 GetTableIndex() const override;
ui32 GetRangeIndex() const override;
ui64 GetRowIndex() const override;
void NextKey() override;
TMaybe<size_t> GetReadByteCount() const override;
bool IsEndOfStream() const override;
bool IsRawReaderExhausted() const override;
protected:
void SkipRow() override;
private:
TVector<const ::google::protobuf::Descriptor*> Descriptors_;
};
// Sometime useful outside mapreduce/yt
void ReadMessageFromNode(const TNode& node, Message* row);
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|