aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/io/stream_raw_reader.cpp
blob: ec19b67d0b0192b6247b849bd7f31a3e4543e6dc (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
#include "stream_table_reader.h"

#include "node_table_reader.h"
#include "proto_table_reader.h"
#include "skiff_table_reader.h"
#include "yamr_table_reader.h"

#include <util/system/env.h>
#include <util/string/type.h>

namespace NYT {

template <>
TTableReaderPtr<TNode> CreateTableReader<TNode>(
    IInputStream* stream, const TTableReaderOptions& /*options*/)
{
    auto impl = ::MakeIntrusive<TNodeTableReader>(
        ::MakeIntrusive<NDetail::TInputStreamProxy>(stream));
    return new TTableReader<TNode>(impl);
}

template <>
TTableReaderPtr<TYaMRRow> CreateTableReader<TYaMRRow>(
    IInputStream* stream, const TTableReaderOptions& /*options*/)
{
    auto impl = ::MakeIntrusive<TYaMRTableReader>(
        ::MakeIntrusive<NDetail::TInputStreamProxy>(stream));
    return new TTableReader<TYaMRRow>(impl);
}


namespace NDetail {

////////////////////////////////////////////////////////////////////////////////

::TIntrusivePtr<IProtoReaderImpl> CreateProtoReader(
    IInputStream* stream,
    const TTableReaderOptions& /* options */,
    const ::google::protobuf::Descriptor* descriptor)
{
    return new TLenvalProtoTableReader(
        ::MakeIntrusive<TInputStreamProxy>(stream),
        {descriptor});
}

::TIntrusivePtr<IProtoReaderImpl> CreateProtoReader(
    IInputStream* stream,
    const TTableReaderOptions& /* options */,
    TVector<const ::google::protobuf::Descriptor*> descriptors)
{
    return new TLenvalProtoTableReader(
        ::MakeIntrusive<TInputStreamProxy>(stream),
        std::move(descriptors));
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NDetail
} // namespace NYT