common.h 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317
  1. #pragma once
  2. ///
  3. /// @file yt/cpp/mapreduce/interface/common.h
  4. ///
  5. /// Header containing miscellaneous structs and classes used in library.
  6. #include "fwd.h"
  7. #include <library/cpp/type_info/type_info.h>
  8. #include <library/cpp/yson/node/node.h>
  9. #include <util/generic/guid.h>
  10. #include <util/generic/map.h>
  11. #include <util/generic/maybe.h>
  12. #include <util/generic/ptr.h>
  13. #include <util/system/type_name.h>
  14. #include <util/generic/vector.h>
  15. #include <google/protobuf/message.h>
  16. #include <initializer_list>
  17. #include <type_traits>
  18. namespace NYT {
  19. ////////////////////////////////////////////////////////////////////////////////
  20. /// @cond Doxygen_Suppress
  21. #define FLUENT_FIELD(type, name) \
  22. type name##_; \
  23. TSelf& name(const type& value) \
  24. { \
  25. name##_ = value; \
  26. return static_cast<TSelf&>(*this); \
  27. } \
  28. static_assert(true)
  29. #define FLUENT_FIELD_ENCAPSULATED(type, name) \
  30. private: \
  31. type name##_; \
  32. public: \
  33. TSelf& name(const type& value) & \
  34. { \
  35. name##_ = value; \
  36. return static_cast<TSelf&>(*this); \
  37. } \
  38. TSelf name(const type& value) && \
  39. { \
  40. name##_ = value; \
  41. return static_cast<TSelf&>(*this); \
  42. } \
  43. const type& name() const & \
  44. { \
  45. return name##_; \
  46. } \
  47. type name() && \
  48. { \
  49. return name##_; \
  50. } \
  51. static_assert(true)
  52. #define FLUENT_FIELD_OPTION(type, name) \
  53. TMaybe<type> name##_; \
  54. TSelf& name(const type& value) \
  55. { \
  56. name##_ = value; \
  57. return static_cast<TSelf&>(*this); \
  58. } \
  59. static_assert(true)
  60. #define FLUENT_FIELD_OPTION_ENCAPSULATED(type, name) \
  61. private: \
  62. TMaybe<type> name##_; \
  63. public: \
  64. TSelf& name(const type& value) & \
  65. { \
  66. name##_ = value; \
  67. return static_cast<TSelf&>(*this); \
  68. } \
  69. TSelf name(const type& value) && \
  70. { \
  71. name##_ = value; \
  72. return static_cast<TSelf&>(*this); \
  73. } \
  74. TSelf& Reset##name() & \
  75. { \
  76. name##_ = Nothing(); \
  77. return static_cast<TSelf&>(*this); \
  78. } \
  79. TSelf Reset##name() && \
  80. { \
  81. name##_ = Nothing(); \
  82. return static_cast<TSelf&>(*this); \
  83. } \
  84. const TMaybe<type>& name() const& \
  85. { \
  86. return name##_; \
  87. } \
  88. TMaybe<type> name() && \
  89. { \
  90. return name##_; \
  91. } \
  92. static_assert(true)
  93. #define FLUENT_FIELD_DEFAULT(type, name, defaultValue) \
  94. type name##_ = defaultValue; \
  95. TSelf& name(const type& value) \
  96. { \
  97. name##_ = value; \
  98. return static_cast<TSelf&>(*this); \
  99. } \
  100. static_assert(true)
  101. #define FLUENT_FIELD_DEFAULT_ENCAPSULATED(type, name, defaultValue) \
  102. private: \
  103. type name##_ = defaultValue; \
  104. public: \
  105. TSelf& name(const type& value) & \
  106. { \
  107. name##_ = value; \
  108. return static_cast<TSelf&>(*this); \
  109. } \
  110. TSelf name(const type& value) && \
  111. { \
  112. name##_ = value; \
  113. return static_cast<TSelf&>(*this); \
  114. } \
  115. const type& name() const & \
  116. { \
  117. return name##_; \
  118. } \
  119. type name() && \
  120. { \
  121. return name##_; \
  122. } \
  123. static_assert(true)
  124. #define FLUENT_VECTOR_FIELD(type, name) \
  125. TVector<type> name##s_; \
  126. TSelf& Add##name(const type& value) \
  127. { \
  128. name##s_.push_back(value); \
  129. return static_cast<TSelf&>(*this);\
  130. } \
  131. TSelf& name##s(TVector<type> values) \
  132. { \
  133. name##s_ = std::move(values); \
  134. return static_cast<TSelf&>(*this);\
  135. } \
  136. static_assert(true)
  137. #define FLUENT_OPTIONAL_VECTOR_FIELD_ENCAPSULATED(type, name) \
  138. private: \
  139. TMaybe<TVector<type>> name##s_; \
  140. public: \
  141. const TMaybe<TVector<type>>& name##s() const & { \
  142. return name##s_; \
  143. } \
  144. TMaybe<TVector<type>>& name##s() & { \
  145. return name##s_; \
  146. } \
  147. TMaybe<TVector<type>> name##s() && { \
  148. return std::move(name##s_); \
  149. } \
  150. TSelf& Add##name(const type& value) & \
  151. { \
  152. if (name##s_.Empty()) { \
  153. name##s_.ConstructInPlace(); \
  154. } \
  155. name##s_->push_back(value); \
  156. return static_cast<TSelf&>(*this);\
  157. } \
  158. TSelf Add##name(const type& value) && \
  159. { \
  160. if (name##s_.Empty()) { \
  161. name##s_.ConstructInPlace(); \
  162. } \
  163. name##s_->push_back(value); \
  164. return static_cast<TSelf&&>(*this);\
  165. } \
  166. TSelf& name##s(TVector<type> values) & \
  167. { \
  168. name##s_ = std::move(values); \
  169. return static_cast<TSelf&>(*this);\
  170. } \
  171. TSelf name##s(TVector<type> values) && \
  172. { \
  173. name##s_ = std::move(values); \
  174. return static_cast<TSelf&&>(*this);\
  175. } \
  176. TSelf& name##s(TNothing) & \
  177. { \
  178. name##s_ = Nothing(); \
  179. return static_cast<TSelf&>(*this);\
  180. } \
  181. TSelf name##s(TNothing) && \
  182. { \
  183. name##s_ = Nothing(); \
  184. return static_cast<TSelf&&>(*this);\
  185. } \
  186. TSelf& Reset##name##s() & \
  187. { \
  188. name##s_ = Nothing(); \
  189. return static_cast<TSelf&>(*this);\
  190. } \
  191. TSelf Reset##name##s() && \
  192. { \
  193. name##s_ = Nothing(); \
  194. return static_cast<TSelf&&>(*this);\
  195. } \
  196. static_assert(true)
  197. #define FLUENT_VECTOR_FIELD_ENCAPSULATED(type, name) \
  198. private: \
  199. TVector<type> name##s_; \
  200. public: \
  201. TSelf& Add##name(const type& value) & \
  202. { \
  203. name##s_.push_back(value); \
  204. return static_cast<TSelf&>(*this);\
  205. } \
  206. TSelf Add##name(const type& value) && \
  207. { \
  208. name##s_.push_back(value); \
  209. return static_cast<TSelf&>(*this);\
  210. } \
  211. TSelf& name##s(TVector<type> value) & \
  212. { \
  213. name##s_ = std::move(value); \
  214. return static_cast<TSelf&>(*this);\
  215. } \
  216. TSelf name##s(TVector<type> value) && \
  217. { \
  218. name##s_ = std::move(value); \
  219. return static_cast<TSelf&>(*this);\
  220. } \
  221. const TVector<type>& name##s() const & \
  222. { \
  223. return name##s_; \
  224. } \
  225. TVector<type> name##s() && \
  226. { \
  227. return name##s_; \
  228. } \
  229. static_assert(true)
  230. #define FLUENT_MAP_FIELD(keytype, valuetype, name) \
  231. TMap<keytype,valuetype> name##_; \
  232. TSelf& Add##name(const keytype& key, const valuetype& value) \
  233. { \
  234. name##_.emplace(key, value); \
  235. return static_cast<TSelf&>(*this);\
  236. } \
  237. static_assert(true)
  238. /// @endcond
  239. ////////////////////////////////////////////////////////////////////////////////
  240. ///
  241. /// @brief Convenience class that keeps sequence of items.
  242. ///
  243. /// Designed to be used as function parameter.
  244. ///
  245. /// Users of such function can then pass:
  246. /// - single item,
  247. /// - initializer list of items,
  248. /// - vector of items;
  249. /// as argument to this function.
  250. ///
  251. /// Example:
  252. /// ```
  253. /// void Foo(const TOneOrMany<int>& arg);
  254. /// ...
  255. /// Foo(1); // ok
  256. /// Foo({1, 2, 3}); // ok
  257. /// ```
  258. template <class T, class TDerived>
  259. struct TOneOrMany
  260. {
  261. /// @cond Doxygen_Suppress
  262. using TSelf = std::conditional_t<std::is_void_v<TDerived>, TOneOrMany, TDerived>;
  263. /// @endcond
  264. /// Initialize with empty sequence.
  265. TOneOrMany() = default;
  266. // Initialize from initializer list.
  267. template<class U>
  268. TOneOrMany(std::initializer_list<U> il)
  269. {
  270. Parts_.assign(il.begin(), il.end());
  271. }
  272. /// Put arguments to sequence
  273. template <class U, class... TArgs>
  274. requires std::is_convertible_v<U, T>
  275. TOneOrMany(U&& arg, TArgs&&... args)
  276. {
  277. Add(arg, std::forward<TArgs>(args)...);
  278. }
  279. /// Initialize from vector.
  280. TOneOrMany(TVector<T> args)
  281. : Parts_(std::move(args))
  282. { }
  283. /// @brief Order is defined the same way as in TVector
  284. bool operator==(const TOneOrMany& rhs) const
  285. {
  286. // N.B. We would like to make this method to be `= default`,
  287. // but this breaks MSVC compiler for the cases when T doesn't
  288. // support comparison.
  289. return Parts_ == rhs.Parts_;
  290. }
  291. ///
  292. /// @{
  293. ///
  294. /// @brief Add all arguments to sequence
  295. template <class U, class... TArgs>
  296. requires std::is_convertible_v<U, T>
  297. TSelf& Add(U&& part, TArgs&&... args) &
  298. {
  299. Parts_.push_back(std::forward<U>(part));
  300. if constexpr (sizeof...(args) > 0) {
  301. [[maybe_unused]] int dummy[sizeof...(args)] = {(Parts_.push_back(std::forward<TArgs>(args)), 0) ... };
  302. }
  303. return static_cast<TSelf&>(*this);
  304. }
  305. template <class U, class... TArgs>
  306. requires std::is_convertible_v<U, T>
  307. TSelf Add(U&& part, TArgs&&... args) &&
  308. {
  309. return std::move(Add(std::forward<U>(part), std::forward<TArgs>(args)...));
  310. }
  311. /// @}
  312. /// Content of sequence.
  313. TVector<T> Parts_;
  314. };
  315. ////////////////////////////////////////////////////////////////////////////////
  316. ///
  317. /// @brief Type of the value that can occur in YT table.
  318. ///
  319. /// @ref NYT::TTableSchema
  320. /// https://ytsaurus.tech/docs/en/user-guide/storage/data-types
  321. enum EValueType : int
  322. {
  323. /// Int64, signed integer of 64 bits.
  324. VT_INT64,
  325. /// Uint64, unsigned integer of 64 bits.
  326. VT_UINT64,
  327. /// Double, floating point number of double precision (64 bits).
  328. VT_DOUBLE,
  329. /// Boolean, `true` or `false`.
  330. VT_BOOLEAN,
  331. /// String, arbitrary byte sequence.
  332. VT_STRING,
  333. /// Any, arbitrary yson document.
  334. VT_ANY,
  335. /// Int8, signed integer of 8 bits.
  336. VT_INT8,
  337. /// Int16, signed integer of 16 bits.
  338. VT_INT16,
  339. /// Int32, signed integer of 32 bits.
  340. VT_INT32,
  341. /// Uint8, unsigned integer of 8 bits.
  342. VT_UINT8,
  343. /// Uint16, unsigned integer of 16 bits.
  344. VT_UINT16,
  345. /// Uint32, unsigned integer of 32 bits.
  346. VT_UINT32,
  347. /// Utf8, byte sequence that is valid utf8.
  348. VT_UTF8,
  349. /// Null, absence of value (almost never used in schemas)
  350. VT_NULL,
  351. /// Void, absence of value (almost never used in schemas) the difference between null, and void is yql-specific.
  352. VT_VOID,
  353. /// Date, number of days since Unix epoch (unsigned)
  354. VT_DATE,
  355. /// Datetime, number of seconds since Unix epoch (unsigned)
  356. VT_DATETIME,
  357. /// Timestamp, number of milliseconds since Unix epoch (unsigned)
  358. VT_TIMESTAMP,
  359. /// Interval, difference between two timestamps (signed)
  360. VT_INTERVAL,
  361. /// Float, floating point number (32 bits)
  362. VT_FLOAT,
  363. /// Json, sequence of bytes that is valid json.
  364. VT_JSON,
  365. // Date32, number of days shifted from Unix epoch, which is 0 (signed)
  366. VT_DATE32,
  367. // Datetime64, number of seconds shifted from Unix epoch, which is 0 (signed)
  368. VT_DATETIME64,
  369. // Timestamp64, number of milliseconds shifted from Unix epoch, which is 0 (signed)
  370. VT_TIMESTAMP64,
  371. // Interval64, difference between two timestamps64 (signed)
  372. VT_INTERVAL64,
  373. };
  374. ///
  375. /// @brief Sort order.
  376. ///
  377. /// @ref NYT::TTableSchema
  378. enum ESortOrder : int
  379. {
  380. /// Ascending sort order.
  381. SO_ASCENDING /* "ascending" */,
  382. /// Descending sort order.
  383. SO_DESCENDING /* "descending" */,
  384. };
  385. ///
  386. /// @brief Value of "optimize_for" attribute.
  387. ///
  388. /// @ref NYT::TRichYPath
  389. enum EOptimizeForAttr : i8
  390. {
  391. /// Optimize for scan
  392. OF_SCAN_ATTR /* "scan" */,
  393. /// Optimize for lookup
  394. OF_LOOKUP_ATTR /* "lookup" */,
  395. };
  396. ///
  397. /// @brief Value of "erasure_codec" attribute.
  398. ///
  399. /// @ref NYT::TRichYPath
  400. enum EErasureCodecAttr : i8
  401. {
  402. /// @cond Doxygen_Suppress
  403. EC_NONE_ATTR /* "none" */,
  404. EC_REED_SOLOMON_6_3_ATTR /* "reed_solomon_6_3" */,
  405. EC_LRC_12_2_2_ATTR /* "lrc_12_2_2" */,
  406. EC_ISA_LRC_12_2_2_ATTR /* "isa_lrc_12_2_2" */,
  407. /// @endcond
  408. };
  409. ///
  410. /// @brief Value of "schema_modification" attribute.
  411. ///
  412. /// @ref NYT::TRichYPath
  413. enum ESchemaModificationAttr : i8
  414. {
  415. SM_NONE_ATTR /* "none" */,
  416. SM_UNVERSIONED_UPDATE /* "unversioned_update" */,
  417. };
  418. ////////////////////////////////////////////////////////////////////////////////
  419. ///
  420. /// @brief Table key column description.
  421. ///
  422. /// The description includes column name and sort order.
  423. ///
  424. /// @anchor TSortOrder_backward_compatibility
  425. /// @note
  426. /// Many functions that use `TSortOrder` as argument used to take `TString`
  427. /// (the only allowed sort order was "ascending" and user didn't have to specify it).
  428. /// @note
  429. /// This class is designed to provide backward compatibility for such code and therefore
  430. /// objects of this class can be constructed and assigned from TString-like objects only.
  431. ///
  432. /// @see NYT::TSortOperationSpec
  433. class TSortColumn
  434. {
  435. public:
  436. /// @cond Doxygen_Suppress
  437. using TSelf = TSortColumn;
  438. /// @endcond
  439. /// Column name
  440. FLUENT_FIELD_ENCAPSULATED(TString, Name);
  441. /// Sort order
  442. FLUENT_FIELD_DEFAULT_ENCAPSULATED(ESortOrder, SortOrder, ESortOrder::SO_ASCENDING);
  443. ///
  444. /// @{
  445. ///
  446. /// @brief Construct object from name and sort order
  447. ///
  448. /// Constructors are intentionally implicit so `TSortColumn` can be compatible with old code.
  449. /// @ref TSortOrder_backward_compatibility
  450. TSortColumn(TStringBuf name = {}, ESortOrder sortOrder = ESortOrder::SO_ASCENDING);
  451. TSortColumn(const TString& name, ESortOrder sortOrder = ESortOrder::SO_ASCENDING);
  452. TSortColumn(const char* name, ESortOrder sortOrder = ESortOrder::SO_ASCENDING);
  453. /// @}
  454. /// Check that sort order is ascending, throw exception otherwise.
  455. const TSortColumn& EnsureAscending() const;
  456. /// @brief Convert sort to yson representation as YT API expects it.
  457. TNode ToNode() const;
  458. /// @brief Comparison is default and checks both name and sort order.
  459. bool operator == (const TSortColumn& rhs) const = default;
  460. ///
  461. /// @{
  462. ///
  463. /// @brief Assign object from column name, and set sort order to `ascending`.
  464. ///
  465. /// This is backward compatibility methods.
  466. ///
  467. /// @ref TSortOrder_backward_compatibility
  468. TSortColumn& operator = (TStringBuf name);
  469. TSortColumn& operator = (const TString& name);
  470. TSortColumn& operator = (const char* name);
  471. /// @}
  472. bool operator == (const TStringBuf rhsName) const;
  473. bool operator == (const TString& rhsName) const;
  474. bool operator == (const char* rhsName) const;
  475. // Intentionally implicit conversions.
  476. operator TString() const;
  477. operator TStringBuf() const;
  478. operator std::string() const;
  479. Y_SAVELOAD_DEFINE(Name_, SortOrder_);
  480. };
  481. ///
  482. /// @brief List of @ref TSortColumn
  483. ///
  484. /// Contains a bunch of helper methods such as constructing from single object.
  485. class TSortColumns
  486. : public TOneOrMany<TSortColumn, TSortColumns>
  487. {
  488. public:
  489. using TOneOrMany<TSortColumn, TSortColumns>::TOneOrMany;
  490. /// Construct empty list.
  491. TSortColumns();
  492. ///
  493. /// @{
  494. ///
  495. /// @brief Construct list of ascending sort order columns by their names.
  496. ///
  497. /// Required for backward compatibility.
  498. ///
  499. /// @ref TSortOrder_backward_compatibility
  500. TSortColumns(const TVector<TString>& names);
  501. TSortColumns(const TColumnNames& names);
  502. /// @}
  503. ///
  504. /// @brief Implicit conversion to column list.
  505. ///
  506. /// If all columns has ascending sort order return list of their names.
  507. /// Throw exception otherwise.
  508. ///
  509. /// Required for backward compatibility.
  510. ///
  511. /// @ref TSortOrder_backward_compatibility
  512. operator TColumnNames() const;
  513. /// Make sure that all columns are of ascending sort order.
  514. const TSortColumns& EnsureAscending() const;
  515. /// Get list of column names.
  516. TVector<TString> GetNames() const;
  517. };
  518. ////////////////////////////////////////////////////////////////////////////////
  519. /// Helper function to create new style type from old style one.
  520. NTi::TTypePtr ToTypeV3(EValueType type, bool required);
  521. ///
  522. /// @brief Single column description
  523. ///
  524. /// Each field describing column has setter and getter.
  525. ///
  526. /// Example reading field:
  527. /// ```
  528. /// ... columnSchema.Name() ...
  529. /// ```
  530. ///
  531. /// Example setting field:
  532. /// ```
  533. /// columnSchema.Name("my-column").Type(VT_INT64); // set name and type
  534. /// ```
  535. ///
  536. /// @ref https://ytsaurus.tech/docs/en/user-guide/storage/static-schema
  537. class TColumnSchema
  538. {
  539. public:
  540. /// @cond Doxygen_Suppress
  541. using TSelf = TColumnSchema;
  542. /// @endcond
  543. ///
  544. /// @brief Construct empty column schemas
  545. ///
  546. /// @note
  547. /// Such schema cannot be used in schema as it it doesn't have name.
  548. TColumnSchema();
  549. ///
  550. /// @{
  551. ///
  552. /// @brief Copy and move constructors are default.
  553. TColumnSchema(const TColumnSchema&) = default;
  554. TColumnSchema& operator=(const TColumnSchema&) = default;
  555. /// @}
  556. FLUENT_FIELD_ENCAPSULATED(TString, Name);
  557. ///
  558. /// @brief Functions to work with type in old manner.
  559. ///
  560. /// @deprecated New code is recommended to work with types using @ref NTi::TTypePtr from type_info library.
  561. TColumnSchema& Type(EValueType type) &;
  562. TColumnSchema Type(EValueType type) &&;
  563. EValueType Type() const;
  564. /// @brief Set and get column type.
  565. /// @{
  566. TColumnSchema& Type(const NTi::TTypePtr& type) &;
  567. TColumnSchema Type(const NTi::TTypePtr& type) &&;
  568. TColumnSchema& TypeV3(const NTi::TTypePtr& type) &;
  569. TColumnSchema TypeV3(const NTi::TTypePtr& type) &&;
  570. NTi::TTypePtr TypeV3() const;
  571. /// @}
  572. ///
  573. /// @brief Raw yson representation of column type
  574. /// @deprecated Prefer to use `TypeV3` methods.
  575. FLUENT_FIELD_OPTION_ENCAPSULATED(TNode, RawTypeV3);
  576. /// Column sort order
  577. FLUENT_FIELD_OPTION_ENCAPSULATED(ESortOrder, SortOrder);
  578. ///
  579. /// @brief Lock group name
  580. ///
  581. /// @ref https://ytsaurus.tech/docs/en/user-guide/dynamic-tables/sorted-dynamic-tables#locking-rows
  582. FLUENT_FIELD_OPTION_ENCAPSULATED(TString, Lock);
  583. /// Expression defining column value
  584. FLUENT_FIELD_OPTION_ENCAPSULATED(TString, Expression);
  585. /// Aggregating function name
  586. FLUENT_FIELD_OPTION_ENCAPSULATED(TString, Aggregate);
  587. ///
  588. /// @brief Storage group name
  589. ///
  590. /// @ref https://ytsaurus.tech/docs/en/user-guide/storage/static-schema
  591. FLUENT_FIELD_OPTION_ENCAPSULATED(TString, Group);
  592. // StableName for renamed and deleted columns.
  593. FLUENT_FIELD_OPTION_ENCAPSULATED(TString, StableName);
  594. /// Deleted column
  595. FLUENT_FIELD_OPTION_ENCAPSULATED(bool, Deleted);
  596. ///
  597. /// @brief Column requiredness.
  598. ///
  599. /// Required columns doesn't accept NULL values.
  600. /// Usually if column is required it means that it has Optional<...> type
  601. bool Required() const;
  602. ///
  603. /// @{
  604. ///
  605. /// @brief Set type in old-style manner
  606. TColumnSchema& Type(EValueType type, bool required) &;
  607. TColumnSchema Type(EValueType type, bool required) &&;
  608. /// @}
  609. private:
  610. friend void Deserialize(TColumnSchema& columnSchema, const TNode& node);
  611. NTi::TTypePtr TypeV3_;
  612. bool Required_ = false;
  613. };
  614. /// Equality check checks all fields of column schema.
  615. bool operator==(const TColumnSchema& lhs, const TColumnSchema& rhs);
  616. ///
  617. /// @brief Description of table schema
  618. ///
  619. /// @see https://ytsaurus.tech/docs/en/user-guide/storage/static-schema
  620. class TTableSchema
  621. {
  622. public:
  623. /// @cond Doxygen_Suppress
  624. using TSelf = TTableSchema;
  625. /// @endcond
  626. /// Column schema
  627. FLUENT_VECTOR_FIELD_ENCAPSULATED(TColumnSchema, Column);
  628. ///
  629. /// @brief Strictness of the schema
  630. ///
  631. /// Strict schemas are not allowed to have columns not described in schema.
  632. /// Nonstrict schemas are allowed to have such columns, all such missing columns are assumed to have
  633. /// type any (or optional<yson> in type_v3 terminology).
  634. FLUENT_FIELD_DEFAULT_ENCAPSULATED(bool, Strict, true);
  635. ///
  636. /// @brief Whether keys are unique
  637. ///
  638. /// This flag can be set only for schemas that have sorted columns.
  639. /// If flag is set table cannot have multiple rows with same key.
  640. FLUENT_FIELD_DEFAULT_ENCAPSULATED(bool, UniqueKeys, false);
  641. /// Get modifiable column list
  642. TVector<TColumnSchema>& MutableColumns();
  643. /// Check if schema has any described column
  644. [[nodiscard]] bool Empty() const;
  645. /// Add column
  646. TTableSchema& AddColumn(const TString& name, const NTi::TTypePtr& type, ESortOrder sortOrder) &;
  647. /// @copydoc NYT::TTableSchema::AddColumn(const TString&, const NTi::TTypePtr&, ESortOrder)&;
  648. TTableSchema AddColumn(const TString& name, const NTi::TTypePtr& type, ESortOrder sortOrder) &&;
  649. /// @copydoc NYT::TTableSchema::AddColumn(const TString&, const NTi::TTypePtr&, ESortOrder)&;
  650. TTableSchema& AddColumn(const TString& name, const NTi::TTypePtr& type) &;
  651. /// @copydoc NYT::TTableSchema::AddColumn(const TString&, const NTi::TTypePtr&, ESortOrder)&;
  652. TTableSchema AddColumn(const TString& name, const NTi::TTypePtr& type) &&;
  653. /// Add optional column of specified type
  654. TTableSchema& AddColumn(const TString& name, EValueType type, ESortOrder sortOrder) &;
  655. /// @copydoc NYT::TTableSchema::AddColumn(const TString&, EValueType, ESortOrder)&;
  656. TTableSchema AddColumn(const TString& name, EValueType type, ESortOrder sortOrder) &&;
  657. /// @copydoc NYT::TTableSchema::AddColumn(const TString&, EValueType, ESortOrder)&;
  658. TTableSchema& AddColumn(const TString& name, EValueType type) &;
  659. /// @copydoc NYT::TTableSchema::AddColumn(const TString&, EValueType, ESortOrder)&;
  660. TTableSchema AddColumn(const TString& name, EValueType type) &&;
  661. ///
  662. /// @brief Make table schema sorted by specified columns
  663. ///
  664. /// Resets old key columns if any
  665. TTableSchema& SortBy(const TSortColumns& columns) &;
  666. /// @copydoc NYT::TTableSchema::SortBy(const TSortColumns&)&;
  667. TTableSchema SortBy(const TSortColumns& columns) &&;
  668. /// Get yson description of table schema
  669. [[nodiscard]] TNode ToNode() const;
  670. /// Parse schema from yson node
  671. static NYT::TTableSchema FromNode(const TNode& node);
  672. friend void Deserialize(TTableSchema& tableSchema, const TNode& node);
  673. };
  674. /// Check for equality of all columns and all schema attributes
  675. bool operator==(const TTableSchema& lhs, const TTableSchema& rhs);
  676. // Pretty printer for unittests
  677. void PrintTo(const TTableSchema& schema, std::ostream* out);
  678. /// Create table schema by protobuf message descriptor
  679. TTableSchema CreateTableSchema(
  680. const ::google::protobuf::Descriptor& messageDescriptor,
  681. const TSortColumns& sortColumns = TSortColumns(),
  682. bool keepFieldsWithoutExtension = true);
  683. /// Create table schema by protobuf message type
  684. template <class TProtoType, typename = std::enable_if_t<std::is_base_of_v<::google::protobuf::Message, TProtoType>>>
  685. inline TTableSchema CreateTableSchema(
  686. const TSortColumns& sortColumns = TSortColumns(),
  687. bool keepFieldsWithoutExtension = true)
  688. {
  689. static_assert(
  690. std::is_base_of_v<::google::protobuf::Message, TProtoType>,
  691. "Template argument must be derived from ::google::protobuf::Message");
  692. return CreateTableSchema(
  693. *TProtoType::descriptor(),
  694. sortColumns,
  695. keepFieldsWithoutExtension);
  696. }
  697. ///
  698. /// @brief Create strict table schema from `struct` type.
  699. ///
  700. /// Names and types of columns are taken from struct member names and types.
  701. /// `Strict` flag is set to true, all other attribute of schema and columns
  702. /// are left with default values
  703. TTableSchema CreateTableSchema(NTi::TTypePtr type);
  704. ////////////////////////////////////////////////////////////////////////////////
  705. ///
  706. /// @brief Enumeration describing comparison operation used in key bound.
  707. ///
  708. /// ERelation is a part of @ref NYT::TKeyBound that can be used as
  709. /// lower or upper key limit in @ref TReadLimit.
  710. ///
  711. /// Relations `Less` and `LessOrEqual` are for upper limit and
  712. /// relations `Greater` and `GreaterOrEqual` are for lower limit.
  713. ///
  714. /// It is a error to use relation in the limit of wrong kind.
  715. ///
  716. /// @see https://ytsaurus.tech/docs/en/user-guide/storage/ypath#rich_ypath
  717. enum class ERelation
  718. {
  719. ///
  720. /// @brief Relation "less"
  721. ///
  722. /// Specifies range of keys that are before specified key.
  723. /// Can only be used in upper limit.
  724. Less /* "<" */,
  725. ///
  726. /// @brief Relation "less or equal"
  727. ///
  728. /// Specifies range of keys that are before or equal specified key.
  729. /// Can only be used in upper limit.
  730. LessOrEqual /* "<=" */,
  731. ///
  732. /// @brief Relation "greater"
  733. ///
  734. /// Specifies range of keys that are after specified key.
  735. /// Can only be used in lower limit.
  736. Greater /* ">" */,
  737. ///
  738. /// @brief Relation "greater or equal"
  739. ///
  740. /// Specifies range of keys that are after or equal than specified key.
  741. /// Can only be used in lower limit.
  742. GreaterOrEqual /* ">=" */,
  743. };
  744. ///
  745. /// @brief Key with relation specifying interval of keys in lower or upper limit of @ref NYT::TReadRange
  746. ///
  747. /// @see https://ytsaurus.tech/docs/en/user-guide/common/ypath#rich_ypath
  748. struct TKeyBound
  749. {
  750. /// @cond Doxygen_Suppress
  751. using TSelf = TKeyBound;
  752. explicit TKeyBound(ERelation relation = ERelation::Less, TKey key = TKey{});
  753. FLUENT_FIELD_DEFAULT_ENCAPSULATED(ERelation, Relation, ERelation::Less);
  754. FLUENT_FIELD_DEFAULT_ENCAPSULATED(TKey, Key, TKey{});
  755. /// @endcond
  756. };
  757. ///
  758. /// @brief Description of the read limit.
  759. ///
  760. /// It is actually a variant and must store exactly one field.
  761. ///
  762. /// @see https://ytsaurus.tech/docs/en/user-guide/common/ypath#rich_ypath
  763. struct TReadLimit
  764. {
  765. /// @cond Doxygen_Suppress
  766. using TSelf = TReadLimit;
  767. /// @endcond
  768. ///
  769. /// @brief KeyBound specifies table key and whether to include it
  770. ///
  771. /// It can be used in lower or upper limit when reading tables.
  772. FLUENT_FIELD_OPTION(TKeyBound, KeyBound);
  773. ///
  774. /// @brief Table key
  775. ///
  776. /// It can be used in exact, lower or upper limit when reading tables.
  777. FLUENT_FIELD_OPTION(TKey, Key);
  778. ///
  779. /// @brief Row index
  780. ///
  781. /// It can be used in exact, lower or upper limit when reading tables.
  782. FLUENT_FIELD_OPTION(i64, RowIndex);
  783. ///
  784. /// @brief File offset
  785. ///
  786. /// It can be used in lower or upper limit when reading files.
  787. FLUENT_FIELD_OPTION(i64, Offset);
  788. ///
  789. /// @brief Tablet index
  790. ///
  791. /// It can be used in lower or upper limit in dynamic table operations
  792. FLUENT_FIELD_OPTION(i64, TabletIndex);
  793. };
  794. ///
  795. /// @brief Range of a table or a file
  796. ///
  797. /// @see https://ytsaurus.tech/docs/en/user-guide/common/ypath#rich_ypath
  798. struct TReadRange
  799. {
  800. using TSelf = TReadRange;
  801. ///
  802. /// @brief Lower limit of the range
  803. ///
  804. /// It is usually inclusive (except when @ref NYT::TKeyBound with relation @ref NYT::ERelation::Greater is used).
  805. FLUENT_FIELD(TReadLimit, LowerLimit);
  806. ///
  807. /// @brief Lower limit of the range
  808. ///
  809. /// It is usually exclusive (except when @ref NYT::TKeyBound with relation @ref NYT::ERelation::LessOrEqual is used).
  810. FLUENT_FIELD(TReadLimit, UpperLimit);
  811. /// Exact key or row index.
  812. FLUENT_FIELD(TReadLimit, Exact);
  813. /// Create read range from row indexes.
  814. static TReadRange FromRowIndices(i64 lowerLimit, i64 upperLimit)
  815. {
  816. return TReadRange()
  817. .LowerLimit(TReadLimit().RowIndex(lowerLimit))
  818. .UpperLimit(TReadLimit().RowIndex(upperLimit));
  819. }
  820. /// Create read range from keys.
  821. static TReadRange FromKeys(const TKey& lowerKeyInclusive, const TKey& upperKeyExclusive)
  822. {
  823. return TReadRange()
  824. .LowerLimit(TReadLimit().Key(lowerKeyInclusive))
  825. .UpperLimit(TReadLimit().Key(upperKeyExclusive));
  826. }
  827. };
  828. ///
  829. /// @brief Path with additional attributes.
  830. ///
  831. /// Allows to specify additional attributes for path used in some operations.
  832. ///
  833. /// @see https://ytsaurus.tech/docs/en/user-guide/storage/ypath#rich_ypath
  834. struct TRichYPath
  835. {
  836. /// @cond Doxygen_Suppress
  837. using TSelf = TRichYPath;
  838. /// @endcond
  839. /// Path itself.
  840. FLUENT_FIELD(TYPath, Path);
  841. /// Specifies that path should be appended not overwritten
  842. FLUENT_FIELD_OPTION(bool, Append);
  843. /// @deprecated Deprecated attribute.
  844. FLUENT_FIELD_OPTION(bool, PartiallySorted);
  845. /// Specifies that path is expected to be sorted by these columns.
  846. FLUENT_FIELD(TSortColumns, SortedBy);
  847. /// Add range to read.
  848. TRichYPath& AddRange(TReadRange range)
  849. {
  850. if (!Ranges_) {
  851. Ranges_.ConstructInPlace();
  852. }
  853. Ranges_->push_back(std::move(range));
  854. return *this;
  855. }
  856. TRichYPath& ResetRanges()
  857. {
  858. Ranges_.Clear();
  859. return *this;
  860. }
  861. ///
  862. /// @{
  863. ///
  864. /// Return ranges to read.
  865. ///
  866. /// NOTE: Nothing (in TMaybe) and empty TVector are different ranges.
  867. /// Nothing represents universal range (reader reads all table rows).
  868. /// Empty TVector represents empty range (reader returns empty set of rows).
  869. const TMaybe<TVector<TReadRange>>& GetRanges() const
  870. {
  871. return Ranges_;
  872. }
  873. TMaybe<TVector<TReadRange>>& MutableRanges()
  874. {
  875. return Ranges_;
  876. }
  877. ///
  878. /// @{
  879. ///
  880. /// Get range view, that is convenient way to iterate through all ranges.
  881. TArrayRef<TReadRange> MutableRangesView()
  882. {
  883. if (Ranges_.Defined()) {
  884. return TArrayRef(Ranges_->data(), Ranges_->size());
  885. } else {
  886. return {};
  887. }
  888. }
  889. TArrayRef<const TReadRange> GetRangesView() const
  890. {
  891. if (Ranges_.Defined()) {
  892. return TArrayRef(Ranges_->data(), Ranges_->size());
  893. } else {
  894. return {};
  895. }
  896. }
  897. /// @}
  898. /// @{
  899. ///
  900. /// Get range by index.
  901. const TReadRange& GetRange(ssize_t i) const
  902. {
  903. return Ranges_.GetRef()[i];
  904. }
  905. TReadRange& MutableRange(ssize_t i)
  906. {
  907. return Ranges_.GetRef()[i];
  908. }
  909. /// @}
  910. ///
  911. /// @brief Specifies columns that should be read.
  912. ///
  913. /// If it's set to Nothing then all columns will be read.
  914. /// If empty TColumnNames is specified then each read row will be empty.
  915. FLUENT_FIELD_OPTION(TColumnNames, Columns);
  916. FLUENT_FIELD_OPTION(bool, Teleport);
  917. FLUENT_FIELD_OPTION(bool, Primary);
  918. FLUENT_FIELD_OPTION(bool, Foreign);
  919. FLUENT_FIELD_OPTION(i64, RowCountLimit);
  920. FLUENT_FIELD_OPTION(TString, FileName);
  921. /// Specifies original path to be shown in Web UI
  922. FLUENT_FIELD_OPTION(TYPath, OriginalPath);
  923. ///
  924. /// @brief Specifies that this path points to executable file
  925. ///
  926. /// Used in operation specs.
  927. FLUENT_FIELD_OPTION(bool, Executable);
  928. ///
  929. /// @brief Specify format to use when loading table.
  930. ///
  931. /// Used in operation specs.
  932. FLUENT_FIELD_OPTION(TNode, Format);
  933. /// @brief Specifies table schema that will be set on the path
  934. FLUENT_FIELD_OPTION(TTableSchema, Schema);
  935. /// Specifies compression codec that will be set on the path
  936. FLUENT_FIELD_OPTION(TString, CompressionCodec);
  937. /// Specifies erasure codec that will be set on the path
  938. FLUENT_FIELD_OPTION(EErasureCodecAttr, ErasureCodec);
  939. /// Specifies schema modification that will be set on the path
  940. FLUENT_FIELD_OPTION(ESchemaModificationAttr, SchemaModification);
  941. /// Specifies optimize_for attribute that will be set on the path
  942. FLUENT_FIELD_OPTION(EOptimizeForAttr, OptimizeFor);
  943. ///
  944. /// @brief Do not put file used in operation into node cache
  945. ///
  946. /// If BypassArtifactCache == true, file will be loaded into the job's sandbox bypassing the cache on the YT node.
  947. /// It helps jobs that use tmpfs to start faster,
  948. /// because files will be loaded into tmpfs directly bypassing disk cache
  949. FLUENT_FIELD_OPTION(bool, BypassArtifactCache);
  950. ///
  951. /// @brief Timestamp of dynamic table.
  952. ///
  953. /// NOTE: it is _not_ unix timestamp
  954. /// (instead it's transaction timestamp, that is more complex structure).
  955. FLUENT_FIELD_OPTION(i64, Timestamp);
  956. ///
  957. /// @brief Specify transaction that should be used to access this path.
  958. ///
  959. /// Allows to start cross-transactional operations.
  960. FLUENT_FIELD_OPTION(TTransactionId, TransactionId);
  961. using TRenameColumnsDescriptor = THashMap<TString, TString>;
  962. /// Specifies columnar mapping which will be applied to columns before transfer to job.
  963. FLUENT_FIELD_OPTION(TRenameColumnsDescriptor, RenameColumns);
  964. /// Create empty path with no attributes
  965. TRichYPath()
  966. { }
  967. ///
  968. /// @{
  969. ///
  970. /// @brief Create path from string
  971. TRichYPath(const char* path)
  972. : Path_(path)
  973. { }
  974. TRichYPath(const TYPath& path)
  975. : Path_(path)
  976. { }
  977. /// @}
  978. private:
  979. TMaybe<TVector<TReadRange>> Ranges_;
  980. };
  981. ///
  982. /// @ref Create copy of @ref NYT::TRichYPath with schema derived from proto message.
  983. ///
  984. ///
  985. template <typename TProtoType>
  986. TRichYPath WithSchema(const TRichYPath& path, const TSortColumns& sortBy = TSortColumns())
  987. {
  988. static_assert(std::is_base_of_v<::google::protobuf::Message, TProtoType>, "TProtoType must be Protobuf message");
  989. auto schemedPath = path;
  990. if (!schemedPath.Schema_) {
  991. schemedPath.Schema(CreateTableSchema<TProtoType>(sortBy));
  992. }
  993. return schemedPath;
  994. }
  995. ///
  996. /// @brief Create copy of @ref NYT::TRichYPath with schema derived from TRowType if possible.
  997. ///
  998. /// If TRowType is protobuf message schema is derived from it and set to returned path.
  999. /// Otherwise schema of original path is left unchanged (and probably unset).
  1000. template <typename TRowType>
  1001. TRichYPath MaybeWithSchema(const TRichYPath& path, const TSortColumns& sortBy = TSortColumns())
  1002. {
  1003. if constexpr (std::is_base_of_v<::google::protobuf::Message, TRowType>) {
  1004. return WithSchema<TRowType>(path, sortBy);
  1005. } else {
  1006. return path;
  1007. }
  1008. }
  1009. ///
  1010. /// @brief Get the list of ranges related to path in compatibility mode.
  1011. ///
  1012. /// - If path is missing ranges, empty list is returned.
  1013. /// - If path has associated range list and the list is not empty, function returns this list.
  1014. /// - If path has associated range list and this list is empty, exception is thrown.
  1015. ///
  1016. /// Before YT-17683 RichYPath didn't support empty range list and empty range actually meant universal range.
  1017. /// This function emulates this old behavior.
  1018. ///
  1019. /// @see https://st.yandex-team.ru/YT-17683
  1020. const TVector<TReadRange>& GetRangesCompat(const TRichYPath& path);
  1021. ////////////////////////////////////////////////////////////////////////////////
  1022. /// Statistics about table columns.
  1023. struct TTableColumnarStatistics
  1024. {
  1025. /// Total data weight for all chunks for each of requested columns.
  1026. THashMap<TString, i64> ColumnDataWeight;
  1027. /// Total weight of all old chunks that don't keep columnar statistics.
  1028. i64 LegacyChunksDataWeight = 0;
  1029. /// Timestamps total weight (only for dynamic tables).
  1030. TMaybe<i64> TimestampTotalWeight;
  1031. };
  1032. ////////////////////////////////////////////////////////////////////////////////
  1033. /// Description of a partition.
  1034. struct TMultiTablePartition
  1035. {
  1036. struct TStatistics
  1037. {
  1038. i64 ChunkCount = 0;
  1039. i64 DataWeight = 0;
  1040. i64 RowCount = 0;
  1041. };
  1042. /// Ranges of input tables for this partition.
  1043. TVector<TRichYPath> TableRanges;
  1044. /// Aggregate statistics of all the table ranges in the partition.
  1045. TStatistics AggregateStatistics;
  1046. };
  1047. /// Table partitions from GetTablePartitions command.
  1048. struct TMultiTablePartitions
  1049. {
  1050. /// Disjoint partitions into which the input tables were divided.
  1051. TVector<TMultiTablePartition> Partitions;
  1052. };
  1053. ////////////////////////////////////////////////////////////////////////////////
  1054. ///
  1055. /// @brief Contains information about tablet
  1056. ///
  1057. /// @see NYT::IClient::GetTabletInfos
  1058. struct TTabletInfo
  1059. {
  1060. ///
  1061. /// @brief Indicates the total number of rows added to the tablet (including trimmed ones).
  1062. ///
  1063. /// Currently only provided for ordered tablets.
  1064. i64 TotalRowCount = 0;
  1065. ///
  1066. /// @brief Contains the number of front rows that are trimmed and are not guaranteed to be accessible.
  1067. ///
  1068. /// Only makes sense for ordered tablet.
  1069. i64 TrimmedRowCount = 0;
  1070. ///
  1071. /// @brief Tablet cell barrier timestamp, which lags behind the current timestamp
  1072. ///
  1073. /// It is guaranteed that all transactions with commit timestamp not exceeding the barrier are fully committed;
  1074. /// e.g. all their added rows are visible (and are included in @ref NYT::TTabletInfo::TotalRowCount).
  1075. /// Mostly makes sense for ordered tablets.
  1076. ui64 BarrierTimestamp;
  1077. };
  1078. ////////////////////////////////////////////////////////////////////////////////
  1079. /// List of attributes to retrieve in operations like @ref NYT::ICypressClient::Get
  1080. struct TAttributeFilter
  1081. {
  1082. /// @cond Doxygen_Suppress
  1083. using TSelf = TAttributeFilter;
  1084. /// @endcond
  1085. /// List of attributes.
  1086. FLUENT_VECTOR_FIELD(TString, Attribute);
  1087. };
  1088. ////////////////////////////////////////////////////////////////////////////////
  1089. ///
  1090. /// @brief Check if none of the fields of @ref NYT::TReadLimit is set.
  1091. ///
  1092. /// @return true if any field of readLimit is set and false otherwise.
  1093. bool IsTrivial(const TReadLimit& readLimit);
  1094. /// Convert yson node type to table schema type
  1095. EValueType NodeTypeToValueType(TNode::EType nodeType);
  1096. ////////////////////////////////////////////////////////////////////////////////
  1097. ///
  1098. /// @brief Enumeration for specifying how reading from master is performed.
  1099. ///
  1100. /// Used in operations like NYT::ICypressClient::Get
  1101. enum class EMasterReadKind : int
  1102. {
  1103. ///
  1104. /// @brief Reading from leader.
  1105. ///
  1106. /// Should almost never be used since it's expensive and for regular uses has no difference from
  1107. /// "follower" read.
  1108. Leader /* "leader" */,
  1109. /// @brief Reading from master follower (default).
  1110. Follower /* "follower" */,
  1111. Cache /* "cache" */,
  1112. MasterCache /* "master_cache" */,
  1113. };
  1114. ////////////////////////////////////////////////////////////////////////////////
  1115. /// @cond Doxygen_Suppress
  1116. namespace NDetail {
  1117. // MUST NOT BE USED BY CLIENTS
  1118. // TODO: we should use default GENERATE_ENUM_SERIALIZATION
  1119. TString ToString(EValueType type);
  1120. } // namespace NDetail
  1121. /// @endcond
  1122. ////////////////////////////////////////////////////////////////////////////////
  1123. } // namespace NYT