aboutsummaryrefslogtreecommitdiffstats
path: root/yt/cpp/mapreduce/client/skiff.h
blob: 82d80a4967a784c7eeac43b347b7d9b8066697ab (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
#pragma once

#include <yt/cpp/mapreduce/common/fwd.h>

#include <yt/cpp/mapreduce/interface/fwd.h>
#include <yt/cpp/mapreduce/interface/common.h>

#include <yt/cpp/mapreduce/skiff/wire_type.h>
#include <yt/cpp/mapreduce/skiff/skiff_schema.h>

#include <util/generic/vector.h>

namespace NYT::NYson {
struct IYsonConsumer;
} // namespace NYT::NYson

namespace NYT {

struct TClientContext;
enum class ENodeReaderFormat : int;

namespace NDetail {

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

struct TCreateSkiffSchemaOptions
{
    using TSelf = TCreateSkiffSchemaOptions;

    FLUENT_FIELD_DEFAULT(bool, HasKeySwitch, false);
    FLUENT_FIELD_DEFAULT(bool, HasRangeIndex, false);

    using TRenameColumnsDescriptor = THashMap<TString, TString>;
    FLUENT_FIELD_OPTION(TRenameColumnsDescriptor, RenameColumns);
};

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

NSkiff::TSkiffSchemaPtr CreateSkiffSchema(
    const TVector<NSkiff::TSkiffSchemaPtr>& tableSchemas,
    const TCreateSkiffSchemaOptions& options);

NSkiff::TSkiffSchemaPtr GetJobInputSkiffSchema();

NSkiff::EWireType ValueTypeToSkiffType(EValueType valueType);

NSkiff::TSkiffSchemaPtr CreateSkiffSchema(
    const TTableSchema& schema,
    const TCreateSkiffSchemaOptions& options = TCreateSkiffSchemaOptions());

NSkiff::TSkiffSchemaPtr CreateSkiffSchema(
    const TNode& schemaNode,
    const TCreateSkiffSchemaOptions& options = TCreateSkiffSchemaOptions());

void Serialize(const NSkiff::TSkiffSchemaPtr& schema, NYson::IYsonConsumer* consumer);

void Deserialize(NSkiff::TSkiffSchemaPtr& schema, const TNode& node);

TFormat CreateSkiffFormat(const NSkiff::TSkiffSchemaPtr& schema);

NSkiff::TSkiffSchemaPtr CreateSkiffSchemaIfNecessary(
    const TClientContext& context,
    const IClientRetryPolicyPtr& clientRetryPolicy,
    const TTransactionId& transactionId,
    ENodeReaderFormat nodeReaderFormat,
    const TVector<TRichYPath>& tablePaths,
    const TCreateSkiffSchemaOptions& options = TCreateSkiffSchemaOptions());

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

} // namespace NDetail
} // namespace NYT