schema.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. #pragma once
  2. #include "public.h"
  3. #include <yt/yt/core/misc/error.h>
  4. #include <yt/yt/core/misc/property.h>
  5. #include <yt/yt/core/misc/range.h>
  6. #include <yt/yt/core/yson/public.h>
  7. #include <yt/yt/core/ytree/public.h>
  8. #include <util/digest/multi.h>
  9. namespace NYT::NTableClient {
  10. ////////////////////////////////////////////////////////////////////////////////
  11. constexpr int PrimaryLockIndex = 0;
  12. DEFINE_ENUM(ELockType,
  13. ((None) (0))
  14. ((SharedWeak) (1))
  15. ((SharedStrong) (2))
  16. ((Exclusive) (3))
  17. ((SharedWrite) (4))
  18. );
  19. // COMPAT(gritukan)
  20. constexpr ELockType MaxOldLockType = ELockType::Exclusive;
  21. bool IsReadLock(ELockType lock);
  22. bool IsWriteLock(ELockType lock);
  23. ELockType GetStrongestLock(ELockType lhs, ELockType rhs);
  24. ////////////////////////////////////////////////////////////////////////////////
  25. class TLegacyLockMask
  26. {
  27. public:
  28. explicit TLegacyLockMask(TLegacyLockBitmap value = 0);
  29. ELockType Get(int index) const;
  30. void Set(int index, ELockType lock);
  31. void Enrich(int columnCount);
  32. TLegacyLockBitmap GetBitmap() const;
  33. TLegacyLockMask(const TLegacyLockMask& other) = default;
  34. TLegacyLockMask& operator= (const TLegacyLockMask& other) = default;
  35. static constexpr int BitsPerType = 2;
  36. static constexpr TLegacyLockBitmap TypeMask = (1 << BitsPerType) - 1;
  37. static constexpr int MaxCount = 8 * sizeof(TLegacyLockBitmap) / BitsPerType;
  38. private:
  39. TLegacyLockBitmap Data_;
  40. };
  41. ////////////////////////////////////////////////////////////////////////////////
  42. class TLockMask
  43. {
  44. public:
  45. TLockMask() = default;
  46. TLockMask(TLockBitmap bitmap, int size);
  47. ELockType Get(int index) const;
  48. void Set(int index, ELockType lock);
  49. void Enrich(int size);
  50. int GetSize() const;
  51. TLockBitmap GetBitmap() const;
  52. // COMPAT(gritukan)
  53. TLegacyLockMask ToLegacyMask() const;
  54. bool HasNewLocks() const;
  55. // NB: Has linear complexity.
  56. bool IsNone() const;
  57. static constexpr int BitsPerType = 4;
  58. static_assert(static_cast<int>(TEnumTraits<ELockType>::GetMaxValue()) < (1 << BitsPerType));
  59. static constexpr ui64 LockMask = (1 << BitsPerType) - 1;
  60. static constexpr int LocksPerWord = 8 * sizeof(TLockBitmap::value_type) / BitsPerType;
  61. static_assert(IsPowerOf2(LocksPerWord));
  62. // Size of the lock mask should fit into ui16 for wire protocol.
  63. static constexpr int MaxSize = (1 << 16) - 1;
  64. private:
  65. TLockBitmap Bitmap_;
  66. int Size_ = 0;
  67. void Reserve(int size);
  68. };
  69. ////////////////////////////////////////////////////////////////////////////////
  70. bool operator == (const TLockMask& lhs, const TLockMask& rhs);
  71. TLockMask MaxMask(TLockMask lhs, TLockMask rhs);
  72. ////////////////////////////////////////////////////////////////////////////////
  73. class TColumnSchema
  74. {
  75. public:
  76. // Keep in sync with hasher below.
  77. DEFINE_BYREF_RO_PROPERTY(TColumnStableName, StableName);
  78. DEFINE_BYREF_RO_PROPERTY(TString, Name);
  79. DEFINE_BYREF_RO_PROPERTY(TLogicalTypePtr, LogicalType);
  80. DEFINE_BYREF_RO_PROPERTY(std::optional<ESortOrder>, SortOrder);
  81. DEFINE_BYREF_RO_PROPERTY(std::optional<TString>, Lock);
  82. DEFINE_BYREF_RO_PROPERTY(std::optional<TString>, Expression);
  83. DEFINE_BYREF_RO_PROPERTY(std::optional<TString>, Aggregate);
  84. DEFINE_BYREF_RO_PROPERTY(std::optional<TString>, Group);
  85. DEFINE_BYREF_RO_PROPERTY(bool, Required);
  86. DEFINE_BYREF_RO_PROPERTY(std::optional<i64>, MaxInlineHunkSize);
  87. public:
  88. TColumnSchema();
  89. TColumnSchema(
  90. TString name,
  91. EValueType type,
  92. std::optional<ESortOrder> sortOrder = {});
  93. TColumnSchema(
  94. TString name,
  95. ESimpleLogicalValueType type,
  96. std::optional<ESortOrder> sortOrder = {});
  97. TColumnSchema(
  98. TString name,
  99. TLogicalTypePtr type,
  100. std::optional<ESortOrder> sortOrder = {});
  101. TColumnSchema(const TColumnSchema&) = default;
  102. TColumnSchema(TColumnSchema&&) = default;
  103. TColumnSchema& operator=(const TColumnSchema&) = default;
  104. TColumnSchema& operator=(TColumnSchema&&) = default;
  105. TColumnSchema& SetStableName(TColumnStableName stableName);
  106. TColumnSchema& SetName(TString name);
  107. TColumnSchema& SetLogicalType(TLogicalTypePtr valueType);
  108. TColumnSchema& SetSimpleLogicalType(ESimpleLogicalValueType type);
  109. TColumnSchema& SetSortOrder(std::optional<ESortOrder> value);
  110. TColumnSchema& SetLock(std::optional<TString> value);
  111. TColumnSchema& SetExpression(std::optional<TString> value);
  112. TColumnSchema& SetAggregate(std::optional<TString> value);
  113. TColumnSchema& SetGroup(std::optional<TString> value);
  114. TColumnSchema& SetRequired(bool value);
  115. TColumnSchema& SetMaxInlineHunkSize(std::optional<i64> value);
  116. EValueType GetWireType() const;
  117. i64 GetMemoryUsage() const;
  118. // Check if column has plain old v1 type.
  119. bool IsOfV1Type() const;
  120. // Check if column has specified v1 type.
  121. bool IsOfV1Type(ESimpleLogicalValueType type) const;
  122. ESimpleLogicalValueType CastToV1Type() const;
  123. bool IsRenamed() const;
  124. TString GetDiagnosticNameString() const;
  125. private:
  126. ESimpleLogicalValueType V1Type_;
  127. EValueType WireType_;
  128. bool IsOfV1Type_;
  129. };
  130. ////////////////////////////////////////////////////////////////////////////////
  131. class TDeletedColumn
  132. {
  133. public:
  134. TDeletedColumn();
  135. explicit TDeletedColumn(TColumnStableName stableName);
  136. DEFINE_BYREF_RO_PROPERTY(TColumnStableName, StableName);
  137. TDeletedColumn& SetStableName(TColumnStableName stableName);
  138. };
  139. ////////////////////////////////////////////////////////////////////////////////
  140. void FormatValue(TStringBuilderBase* builder, const TColumnSchema& schema, TStringBuf spec);
  141. void Serialize(const TColumnSchema& schema, NYson::IYsonConsumer* consumer);
  142. void ToProto(NProto::TColumnSchema* protoSchema, const TColumnSchema& schema);
  143. void FromProto(TColumnSchema* schema, const NProto::TColumnSchema& protoSchema);
  144. void ToProto(NProto::TDeletedColumn* protoSchema, const TDeletedColumn& schema);
  145. void FromProto(TDeletedColumn* schema, const NProto::TDeletedColumn& protoSchema);
  146. void PrintTo(const TColumnSchema& columnSchema, std::ostream* os);
  147. ////////////////////////////////////////////////////////////////////////////////
  148. class TTableSchema final
  149. {
  150. public:
  151. class TNameMapping
  152. {
  153. public:
  154. explicit TNameMapping(const TTableSchema& schema);
  155. bool IsDeleted(const TColumnStableName& stableName) const;
  156. TString StableNameToName(const TColumnStableName& stableName) const;
  157. TColumnStableName NameToStableName(TStringBuf name) const;
  158. private:
  159. const TTableSchema& Schema_;
  160. };
  161. public:
  162. const std::vector<TColumnSchema>& Columns() const;
  163. const std::vector<TDeletedColumn>& DeletedColumns() const;
  164. //! Strict schema forbids columns not specified in the schema.
  165. DEFINE_BYVAL_RO_PROPERTY(bool, Strict, false);
  166. DEFINE_BYVAL_RO_PROPERTY(bool, UniqueKeys, false);
  167. DEFINE_BYVAL_RO_PROPERTY(ETableSchemaModification, SchemaModification, ETableSchemaModification::None);
  168. //! Constructs an empty non-strict schema.
  169. TTableSchema() = default;
  170. TTableSchema(TTableSchema&&) = default;
  171. TTableSchema& operator=(TTableSchema&&) = default;
  172. TTableSchema(const TTableSchema&) = default;
  173. TTableSchema& operator=(const TTableSchema&) = default;
  174. //! Constructs a schema with given columns and strictness flag.
  175. //! No validation is performed.
  176. explicit TTableSchema(
  177. std::vector<TColumnSchema> columns,
  178. bool strict = true,
  179. bool uniqueKeys = false,
  180. ETableSchemaModification schemaModification = ETableSchemaModification::None,
  181. std::vector<TDeletedColumn> deletedColumns = {});
  182. const TColumnSchema* FindColumnByStableName(const TColumnStableName& stableName) const;
  183. const TDeletedColumn* FindDeletedColumn(const TColumnStableName& stableName) const;
  184. int GetColumnIndex(const TColumnSchema& column) const;
  185. int GetColumnIndex(TStringBuf name) const;
  186. int GetColumnIndexOrThrow(TStringBuf name) const;
  187. TNameMapping GetNameMapping() const;
  188. const TColumnSchema* FindColumn(TStringBuf name) const;
  189. const TColumnSchema& GetColumn(TStringBuf name) const;
  190. const TColumnSchema& GetColumnOrThrow(TStringBuf name) const;
  191. std::vector<TString> GetColumnNames() const;
  192. TTableSchemaPtr Filter(
  193. const TColumnFilter& columnFilter,
  194. bool discardSortOrder = false) const;
  195. TTableSchemaPtr Filter(
  196. const THashSet<TString>& columnNames,
  197. bool discardSortOrder = false) const;
  198. TTableSchemaPtr Filter(
  199. const std::optional<std::vector<TString>>& columnNames,
  200. bool discardSortOrder = false) const;
  201. bool HasComputedColumns() const;
  202. bool HasAggregateColumns() const;
  203. bool HasHunkColumns() const;
  204. bool HasTimestampColumn() const;
  205. bool HasTtlColumn() const;
  206. bool IsSorted() const;
  207. bool IsUniqueKeys() const;
  208. bool HasRenamedColumns() const;
  209. bool IsEmpty() const;
  210. std::optional<int> GetTtlColumnIndex() const;
  211. std::vector<TColumnStableName> GetKeyColumnStableNames() const;
  212. TKeyColumns GetKeyColumnNames() const;
  213. TKeyColumns GetKeyColumns() const;
  214. int GetColumnCount() const;
  215. int GetKeyColumnCount() const;
  216. int GetValueColumnCount() const;
  217. std::vector<TColumnStableName> GetColumnStableNames() const;
  218. const THunkColumnIds& GetHunkColumnIds() const;
  219. TSortColumns GetSortColumns(const std::optional<TNameMapping>& nameMapping = std::nullopt) const;
  220. bool HasNontrivialSchemaModification() const;
  221. //! Constructs a non-strict schema from #keyColumns assigning all components EValueType::Any type.
  222. //! #keyColumns could be empty, in which case an empty non-strict schema is returned.
  223. //! The resulting schema is validated.
  224. static TTableSchemaPtr FromKeyColumns(const TKeyColumns& keyColumns);
  225. //! Same as above, but infers key column sort orders from #sortColumns.
  226. static TTableSchemaPtr FromSortColumns(const TSortColumns& sortColumns);
  227. //! Returns schema with `UniqueKeys' set to given value.
  228. TTableSchemaPtr SetUniqueKeys(bool uniqueKeys) const;
  229. //! Returns schema with `SchemaModification' set to given value.
  230. TTableSchemaPtr SetSchemaModification(ETableSchemaModification schemaModification) const;
  231. //! For sorted tables, return the current schema as-is.
  232. //! For ordered tables, prepends the current schema with |(tablet_index, row_index)| key columns.
  233. TTableSchemaPtr ToQuery() const;
  234. //! For sorted tables, return the current schema without computed columns.
  235. //! For ordered tables, prepends the current schema with |(tablet_index)| key column
  236. //! but without |$timestamp| column, if any.
  237. TTableSchemaPtr ToWrite() const;
  238. //! For sorted tables, return the current schema
  239. //! For ordered tables, prepends the current schema with |(tablet_index)| key column.
  240. TTableSchemaPtr WithTabletIndex() const;
  241. //! Returns the current schema as-is.
  242. //! For ordered tables, prepends the current schema with |(tablet_index)| key column.
  243. TTableSchemaPtr ToVersionedWrite() const;
  244. //! For sorted tables, returns the non-computed key columns.
  245. //! For ordered tables, returns an empty schema.
  246. TTableSchemaPtr ToLookup() const;
  247. //! For sorted tables, returns the non-computed key columns.
  248. //! For ordered tables, returns an empty schema.
  249. TTableSchemaPtr ToDelete() const;
  250. //! Returns just the key columns.
  251. TTableSchemaPtr ToKeys() const;
  252. //! Returns the schema with UniqueKeys set to |true|.
  253. TTableSchemaPtr ToUniqueKeys() const;
  254. //! Returns the schema with all column attributes unset except
  255. //! StableName, Name, Type and Required.
  256. TTableSchemaPtr ToStrippedColumnAttributes() const;
  257. //! Returns the schema with all column attributes unset except
  258. //! StableName, Name, Type, Required and SortOrder.
  259. TTableSchemaPtr ToSortedStrippedColumnAttributes() const;
  260. //! Returns (possibly reordered) schema sorted by column names.
  261. TTableSchemaPtr ToCanonical() const;
  262. //! Returns (possibly reordered) schema with set key columns.
  263. TTableSchemaPtr ToSorted(const TKeyColumns& keyColumns) const;
  264. TTableSchemaPtr ToSorted(const TSortColumns& sortColumns) const;
  265. //! Only applies to sorted replicated tables.
  266. //! Returns the ordered schema used in replication logs.
  267. TTableSchemaPtr ToReplicationLog() const;
  268. //! Only applies to sorted dynamic tables.
  269. //! Returns the static schema used for unversioned updates from bulk insert.
  270. //! Key columns remain unchanged. Additional column |($change_type)| is prepended.
  271. //! Each value column |name| is replaced with two columns |($value:name)| and |($flags:name)|.
  272. //! If |sorted| is |false|, sort order is removed from key columns.
  273. TTableSchemaPtr ToUnversionedUpdate(bool sorted = true) const;
  274. TTableSchemaPtr ToModifiedSchema(ETableSchemaModification schemaModification) const;
  275. TComparator ToComparator() const;
  276. TKeyColumnTypes GetKeyColumnTypes() const;
  277. void Save(TStreamSaveContext& context) const;
  278. void Load(TStreamLoadContext& context);
  279. i64 GetMemoryUsage() const;
  280. private:
  281. struct TColumnInfo
  282. {
  283. TColumnInfo(std::vector<TColumnSchema> columns, std::vector<TDeletedColumn> deletedColumns)
  284. : Columns(std::move(columns))
  285. , DeletedColumns(std::move(deletedColumns))
  286. {
  287. }
  288. std::vector<TColumnSchema> Columns;
  289. std::vector<TDeletedColumn> DeletedColumns;
  290. };
  291. std::shared_ptr<const TColumnInfo> ColumnInfo_;
  292. int KeyColumnCount_ = 0;
  293. bool HasComputedColumns_ = false;
  294. bool HasAggregateColumns_ = false;
  295. THunkColumnIds HunkColumnsIds_;
  296. THashMap<TStringBuf, int> StableNameToColumnIndex_;
  297. THashMap<TStringBuf, int> NameToColumnIndex_;
  298. THashMap<TStringBuf, int> StableNameToDeletedColumnIndex_;
  299. };
  300. DEFINE_REFCOUNTED_TYPE(TTableSchema)
  301. ////////////////////////////////////////////////////////////////////////////////
  302. void FormatValue(TStringBuilderBase* builder, const TTableSchema& schema, TStringBuf spec);
  303. void FormatValue(TStringBuilderBase* builder, const TTableSchemaPtr& schema, TStringBuf spec);
  304. TString ToString(const TTableSchema& schema);
  305. TString ToString(const TTableSchemaPtr& schema);
  306. //! Returns serialized NTableClient.NProto.TTableSchemaExt.
  307. TString SerializeToWireProto(const TTableSchemaPtr& schema);
  308. void DeserializeFromWireProto(TTableSchemaPtr* schema, const TString& serializedProto);
  309. void Serialize(const TTableSchema& schema, NYson::IYsonConsumer* consumer);
  310. void Deserialize(TTableSchema& schema, NYTree::INodePtr node);
  311. void Deserialize(TTableSchema& schema, NYson::TYsonPullParserCursor* cursor);
  312. void Serialize(const TTableSchemaPtr& schema, NYson::IYsonConsumer* consumer);
  313. void Deserialize(TTableSchemaPtr& schema, NYTree::INodePtr node);
  314. void Deserialize(TTableSchemaPtr& schema, NYson::TYsonPullParserCursor* cursor);
  315. void ToProto(NProto::TTableSchemaExt* protoSchema, const TTableSchema& schema);
  316. void FromProto(TTableSchema* schema, const NProto::TTableSchemaExt& protoSchema);
  317. void FromProto(
  318. TTableSchema* schema,
  319. const NProto::TTableSchemaExt& protoSchema,
  320. const NProto::TKeyColumnsExt& keyColumnsExt);
  321. void ToProto(NProto::TTableSchemaExt* protoSchema, const TTableSchemaPtr& schema);
  322. void FromProto(TTableSchemaPtr* schema, const NProto::TTableSchemaExt& protoSchema);
  323. void FromProto(
  324. TTableSchemaPtr* schema,
  325. const NProto::TTableSchemaExt& protoSchema,
  326. const NProto::TKeyColumnsExt& keyColumnsExt);
  327. void PrintTo(const TTableSchema& tableSchema, std::ostream* os);
  328. ////////////////////////////////////////////////////////////////////////////////
  329. bool operator == (const TColumnSchema& lhs, const TColumnSchema& rhs);
  330. bool operator == (const TDeletedColumn& lhs, const TDeletedColumn& rhs);
  331. bool operator == (const TTableSchema& lhs, const TTableSchema& rhs);
  332. // Compat function for https://st.yandex-team.ru/YT-10668 workaround.
  333. bool IsEqualIgnoringRequiredness(const TTableSchema& lhs, const TTableSchema& rhs);
  334. ////////////////////////////////////////////////////////////////////////////////
  335. static constexpr TStringBuf NonexistentColumnName = "$__YT_NONEXISTENT_COLUMN_NAME__";
  336. std::vector<TColumnStableName> MapNamesToStableNames(
  337. const TTableSchema& schema,
  338. std::vector<TString> names,
  339. const std::optional<TStringBuf>& missingColumnReplacement = std::nullopt);
  340. ////////////////////////////////////////////////////////////////////////////////
  341. void ValidateKeyColumns(const TKeyColumns& keyColumns);
  342. void ValidateColumnName(const TString& name);
  343. void ValidateColumnSchema(
  344. const TColumnSchema& columnSchema,
  345. bool isTableSorted = false,
  346. bool isTableDynamic = false,
  347. bool allowUnversionedUpdateColumns = false);
  348. void ValidateTableSchema(
  349. const TTableSchema& schema,
  350. bool isTableDynamic = false,
  351. bool allowUnversionedUpdateColumns = false);
  352. void ValidateNoDescendingSortOrder(const TTableSchema& schema);
  353. void ValidateNoRenamedColumns(const TTableSchema& schema);
  354. void ValidateColumnUniqueness(const TTableSchema& schema);
  355. void ValidatePivotKey(
  356. TUnversionedRow pivotKey,
  357. const TTableSchema& schema,
  358. TStringBuf keyType = "pivot",
  359. bool validateRequired = false);
  360. ////////////////////////////////////////////////////////////////////////////////
  361. THashMap<TString, int> GetLocksMapping(
  362. const NTableClient::TTableSchema& schema,
  363. bool fullAtomicity,
  364. std::vector<int>* columnIndexToLockIndex = nullptr,
  365. std::vector<TString>* lockIndexToName = nullptr);
  366. TLockMask GetLockMask(
  367. const NTableClient::TTableSchema& schema,
  368. bool fullAtomicity,
  369. const std::vector<TString>& locks,
  370. ELockType lockType = ELockType::SharedWeak);
  371. ////////////////////////////////////////////////////////////////////////////////
  372. // NB: Need to place this into NProto for ADL to work properly since TKeyColumns is std::vector.
  373. namespace NProto {
  374. void ToProto(NProto::TKeyColumnsExt* protoKeyColumns, const TKeyColumns& keyColumns);
  375. void FromProto(TKeyColumns* keyColumns, const NProto::TKeyColumnsExt& protoKeyColumns);
  376. void ToProto(TColumnFilter* protoColumnFilter, const NTableClient::TColumnFilter& columnFilter);
  377. void FromProto(NTableClient::TColumnFilter* columnFilter, const TColumnFilter& protoColumnFilter);
  378. } // namespace NProto
  379. ////////////////////////////////////////////////////////////////////////////////
  380. // Incompatible < RequireValidation < FullyCompatible
  381. constexpr bool operator < (ESchemaCompatibility lhs, ESchemaCompatibility rhs);
  382. constexpr bool operator <= (ESchemaCompatibility lhs, ESchemaCompatibility rhs);
  383. constexpr bool operator > (ESchemaCompatibility lhs, ESchemaCompatibility rhs);
  384. constexpr bool operator >= (ESchemaCompatibility lhs, ESchemaCompatibility rhs);
  385. ////////////////////////////////////////////////////////////////////////////////
  386. struct TTableSchemaHash
  387. {
  388. size_t operator() (const TTableSchema& schema) const;
  389. size_t operator() (const TTableSchemaPtr& schema) const;
  390. };
  391. struct TTableSchemaEquals
  392. {
  393. bool operator() (const TTableSchema& lhs, const TTableSchema& rhs) const;
  394. bool operator() (const TTableSchemaPtr& lhs, const TTableSchemaPtr& rhs) const;
  395. bool operator() (const TTableSchemaPtr& lhs, const TTableSchema& rhs) const;
  396. };
  397. struct TCellTaggedTableSchema
  398. {
  399. TCellTaggedTableSchema(TTableSchema tableSchema, NObjectClient::TCellTag cellTag);
  400. TTableSchema TableSchema;
  401. NObjectClient::TCellTag CellTag;
  402. };
  403. struct TCellTaggedTableSchemaPtr
  404. {
  405. TCellTaggedTableSchemaPtr(TTableSchemaPtr tableSchema, NObjectClient::TCellTag cellTag);
  406. TTableSchemaPtr TableSchema;
  407. NObjectClient::TCellTag CellTag;
  408. };
  409. ////////////////////////////////////////////////////////////////////////////////
  410. struct TCellTaggedTableSchemaHash
  411. {
  412. size_t operator() (const TCellTaggedTableSchema& cellTaggedSchema) const;
  413. size_t operator() (const TCellTaggedTableSchemaPtr& cellTaggedSchemaPtr) const;
  414. };
  415. struct TCellTaggedTableSchemaEquals
  416. {
  417. bool operator() (const TCellTaggedTableSchema& lhs, const TCellTaggedTableSchema& rhs) const;
  418. bool operator() (const TCellTaggedTableSchemaPtr& lhs, const TCellTaggedTableSchemaPtr& rhs) const;
  419. bool operator() (const TCellTaggedTableSchemaPtr& lhs, const TCellTaggedTableSchema& rhs) const;
  420. };
  421. ////////////////////////////////////////////////////////////////////////////////
  422. } // namespace NYT::NTableClient
  423. ////////////////////////////////////////////////////////////////////////////////
  424. template <>
  425. struct THash<NYT::NTableClient::TColumnStableName>
  426. {
  427. size_t operator()(const NYT::NTableClient::TColumnStableName& stableName) const;
  428. };
  429. template <>
  430. struct THash<NYT::NTableClient::TDeletedColumn>
  431. {
  432. size_t operator()(const NYT::NTableClient::TDeletedColumn& deletedColumn) const;
  433. };
  434. template <>
  435. struct THash<NYT::NTableClient::TColumnSchema>
  436. {
  437. size_t operator()(const NYT::NTableClient::TColumnSchema& columnSchema) const;
  438. };
  439. template <>
  440. struct THash<NYT::NTableClient::TTableSchema>
  441. {
  442. size_t operator()(const NYT::NTableClient::TTableSchema& tableSchema) const;
  443. };
  444. ////////////////////////////////////////////////////////////////////////////////
  445. #define SCHEMA_INL_H_
  446. #include "schema-inl.h"
  447. #undef SCHEMA_INL_H_