blob: 95ece5f9c7e0779df8f657fd9020d8eac09fd483 (
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
|
#pragma once
#include "counting_raw_reader.h"
#include <yt/cpp/mapreduce/interface/io.h>
#include <yt/cpp/mapreduce/skiff/wire_type.h>
#include <yt/cpp/mapreduce/skiff/unchecked_parser.h>
#include <util/stream/buffered.h>
namespace NYT {
namespace NDetail {
////////////////////////////////////////////////////////////////////////////////
class TSkiffTableReader
: public INodeReaderImpl
{
public:
TSkiffTableReader(
::TIntrusivePtr<TRawTableReader> input,
const std::shared_ptr<NSkiff::TSkiffSchema>& schema);
~TSkiffTableReader() override;
virtual const TNode& GetRow() const override;
virtual void MoveRow(TNode* 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 IsRawReaderExhausted() const override;
private:
struct TSkiffTableSchema;
private:
void EnsureValidity() const;
void ReadRow();
static TVector<TSkiffTableSchema> CreateSkiffTableSchemas(const std::shared_ptr<NSkiff::TSkiffSchema>& schema);
private:
NDetail::TCountingRawTableReader Input_;
TBufferedInput BufferedInput_;
std::optional<NSkiff::TUncheckedSkiffParser> Parser_;
TVector<TSkiffTableSchema> Schemas_;
TNode Row_;
bool Valid_ = true;
bool AfterKeySwitch_ = false;
bool Finished_ = false;
TMaybe<ui64> RangeIndex_;
TMaybe<ui64> RowIndex_;
ui32 TableIndex_ = 0;
};
////////////////////////////////////////////////////////////////////////////////
} // namespace NDetail
} // namespace NYT
|