C++ YT Wrapper
C++ library for working with YT clusters
Loading...
Searching...
No Matches
format.h
Go to the documentation of this file.
1#pragma once
2
7
8#include "node.h"
9
10#include <google/protobuf/descriptor.h>
11
12namespace NYT {
13
15
18{
20 TVector<TString> KeyColumnNames;
21
23 TVector<TString> SubkeyColumnNames;
24};
25
27
37struct TFormat
38{
39public:
41 TNode Config;
42
43public:
47 explicit TFormat(const TNode& config = TNode());
48
52 static TFormat YsonText();
53
58
63
68 const TVector<const ::google::protobuf::Descriptor*>& descriptors,
69 bool withDescriptors = false);
70
74 static TFormat Json();
75
79 static TFormat Dsv();
80
86 template<typename T>
87 static inline TFormat Protobuf(bool withDescriptors = false);
88
92 bool IsTextYson() const;
93
97 bool IsProtobuf() const;
98
102 bool IsYamredDsv() const;
103
108};
109
111
112template<typename T>
113TFormat TFormat::Protobuf(bool withDescriptors) {
114 return TFormat::Protobuf({T::descriptor()}, withDescriptors);
115}
116
122 const ::google::protobuf::Descriptor& messageDescriptor,
123 bool keepFieldsWithoutExtension);
124
126
127} // namespace NYT
Description of table schema.
Definition common.h:771
Main namespace of YT client.
Definition abortable_stream.h:7
TTableSchema CreateTableSchema(const ::google::protobuf::Descriptor &messageDescriptor, const TSortColumns &sortColumns=TSortColumns(), bool keepFieldsWithoutExtension=true)
Create table schema by protobuf message descriptor.
bool IsYamredDsv() const
Is the format YaMR?
bool IsProtobuf() const
Is the format protobuf?
static TFormat Dsv()
Create DSV (TSKV) format.
static TFormat YaMRLenval()
Create YaMR format.
TFormat(const TNode &config=TNode())
Construct format from given YT format representation.
TNode Config
Format representation understandable by YT.
Definition format.h:41
bool IsTextYson() const
Is the format text YSON?
static TFormat Protobuf(const TVector< const ::google::protobuf::Descriptor * > &descriptors, bool withDescriptors=false)
Create protobuf format from protobuf message descriptors.
static TFormat YsonText()
Create text YSON format.
static TFormat YsonBinary()
Create binary YSON format.
static TFormat Json()
Create JSON format.
TYamredDsvAttributes GetYamredDsvAttributes() const
For YAMR format returns its attributes in structured way.
Definition format.h:18
TVector< TString > SubkeyColumnNames
Names of subkey columns.
Definition format.h:23
TVector< TString > KeyColumnNames
Names of key columns.
Definition format.h:20