blob: 84525450053a2ef9488da6fc9ff41c1582129311 (
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
77
78
79
80
81
|
#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 = default;
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);
explicit TLenvalProtoTableReader(
::TIntrusivePtr<TRawTableReader> input);
~TLenvalProtoTableReader() override = default;
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:
bool ValidateProtoDescriptor_;
TVector<const ::google::protobuf::Descriptor*> Descriptors_;
};
// Sometime useful outside mapreduce/yt
void ReadMessageFromNode(const TNode& node, Message* row);
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT
|