protobuf_table_schema_ut.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. import "yt/yt_proto/yt/formats/extension.proto";
  2. package NYT.NUnitTesting;
  3. message TIntegral
  4. {
  5. optional double DoubleField = 1;
  6. optional float FloatField = 2;
  7. optional int32 Int32Field = 3;
  8. optional int64 Int64Field = 4;
  9. optional uint32 Uint32Field = 5;
  10. optional uint64 Uint64Field = 6;
  11. optional sint32 Sint32Field = 7;
  12. optional sint64 Sint64Field = 8;
  13. optional fixed32 Fixed32Field = 9;
  14. optional fixed64 Fixed64Field = 10;
  15. optional sfixed32 Sfixed32Field = 11;
  16. optional sfixed64 Sfixed64Field = 12;
  17. optional bool BoolField = 13;
  18. enum TriBool
  19. {
  20. TRI_FALSE = 0;
  21. TRI_TRUE = 1;
  22. TRI_UNDEF = -1;
  23. }
  24. optional TriBool EnumField = 14;
  25. }
  26. message TRepeated
  27. {
  28. repeated int32 Int32Field = 1;
  29. }
  30. message TRepeatedYtMode
  31. {
  32. option (NYT.default_field_flags) = SERIALIZATION_YT;
  33. repeated int32 Int32Field = 1;
  34. }
  35. message TWithTypeOptions
  36. {
  37. enum Color
  38. {
  39. WHITE = 0;
  40. BLUE = 1;
  41. RED = -1;
  42. }
  43. message TEmbedded
  44. {
  45. option (NYT.default_field_flags) = SERIALIZATION_YT;
  46. optional Color ColorIntField = 1 [(NYT.flags) = ENUM_INT];
  47. optional Color ColorStringField = 2 [(NYT.flags) = ENUM_STRING];
  48. optional bytes AnyField = 3 [(NYT.flags) = ANY];
  49. }
  50. optional Color ColorIntField = 1 [(NYT.flags) = ENUM_INT];
  51. optional Color ColorStringField = 2 [(NYT.flags) = ENUM_STRING];
  52. optional bytes AnyField = 3 [(NYT.flags) = ANY];
  53. optional bytes OtherColumnsField = 4 [(NYT.flags) = OTHER_COLUMNS];
  54. optional TEmbedded EmbeddedField = 5 [(NYT.flags) = SERIALIZATION_YT];
  55. repeated Color RepeatedEnumIntField = 6 [(NYT.flags) = SERIALIZATION_YT, (NYT.flags) = ENUM_INT];
  56. }
  57. message TWithTypeOptions_TypeMismatch_EnumInt
  58. {
  59. optional int64 EnumField = 1 [(NYT.flags) = ENUM_INT];
  60. }
  61. message TWithTypeOptions_TypeMismatch_EnumString
  62. {
  63. optional string EnumField = 1 [(NYT.flags) = ENUM_STRING];
  64. }
  65. message TWithTypeOptions_TypeMismatch_Any
  66. {
  67. optional string AnyField = 1 [(NYT.flags) = ANY];
  68. }
  69. message TWithTypeOptions_TypeMismatch_OtherColumns
  70. {
  71. optional string OtherColumnsField = 1 [(NYT.flags) = OTHER_COLUMNS];
  72. }
  73. message TOneOf
  74. {
  75. oneof Chooser
  76. {
  77. double DoubleField = 1;
  78. int32 Int32Field = 2;
  79. }
  80. optional bool BoolField = 3;
  81. }
  82. message TWithRequired
  83. {
  84. required string RequiredField = 1;
  85. optional string NotRequiredField = 2;
  86. };
  87. message TAggregated
  88. {
  89. optional string StringField = 1;
  90. optional bytes BytesField = 2;
  91. optional TIntegral NestedField = 3;
  92. optional TRepeated NestedRepeatedField = 4;
  93. optional TOneOf NestedOneOfField = 5;
  94. optional TAggregated NestedRecursiveField = 6;
  95. }
  96. message TAliased
  97. {
  98. optional int32 Key = 1 [(NYT.key_column_name) = "key"];
  99. optional double Subkey = 2 [(NYT.key_column_name) = "subkey"];
  100. optional TAggregated Data = 3;
  101. }
  102. ////////////////////////////////////////////////////////////////////////////////
  103. message TUrlRow
  104. {
  105. optional string Host = 1 [(NYT.column_name) = "Host"];
  106. optional string Path = 2 [(NYT.column_name) = "Path"];
  107. optional sint32 HttpCode = 3 [(NYT.column_name) = "HttpCode"];
  108. }
  109. message TRowFieldSerializationOption
  110. {
  111. optional TUrlRow UrlRow_1 = 1 [(NYT.flags) = SERIALIZATION_YT];
  112. optional TUrlRow UrlRow_2 = 2;
  113. }
  114. message TRowMessageSerializationOption
  115. {
  116. option (NYT.default_field_flags) = SERIALIZATION_YT;
  117. optional TUrlRow UrlRow_1 = 1;
  118. optional TUrlRow UrlRow_2 = 2;
  119. }
  120. message TRowMixedSerializationOptions
  121. {
  122. option (NYT.default_field_flags) = SERIALIZATION_YT;
  123. optional TUrlRow UrlRow_1 = 1;
  124. optional TUrlRow UrlRow_2 = 2 [(NYT.flags) = SERIALIZATION_PROTOBUF];
  125. }
  126. message TRowSerializedRepeatedFields
  127. {
  128. option (NYT.default_field_flags) = SERIALIZATION_YT;
  129. repeated int64 Ints = 1;
  130. repeated TUrlRow UrlRows = 2;
  131. }
  132. message TUrlRowWithColumnNames
  133. {
  134. optional string Host = 1 [(NYT.column_name) = "Host_ColumnName", (NYT.key_column_name) = "Host_KeyColumnName"];
  135. optional string Path = 2 [(NYT.key_column_name) = "Path_KeyColumnName"];
  136. optional sint32 HttpCode = 3;
  137. }
  138. message TRowMixedSerializationOptions_ColumnNames
  139. {
  140. option (NYT.default_field_flags) = SERIALIZATION_YT;
  141. optional TUrlRowWithColumnNames UrlRow_1 = 1;
  142. optional TUrlRowWithColumnNames UrlRow_2 = 2 [(NYT.flags) = SERIALIZATION_PROTOBUF];
  143. }
  144. message TNoOptionInheritance
  145. {
  146. message TDeepestEmbedded
  147. {
  148. optional int64 x = 1;
  149. }
  150. message TEmbedded
  151. {
  152. optional TDeepestEmbedded embedded = 1;
  153. }
  154. message TEmbeddedYt
  155. {
  156. option (NYT.default_field_flags) = SERIALIZATION_YT;
  157. optional TDeepestEmbedded embedded = 1;
  158. }
  159. message TEmbeddedProtobuf
  160. {
  161. option (NYT.default_field_flags) = SERIALIZATION_PROTOBUF;
  162. optional TDeepestEmbedded embedded = 1;
  163. }
  164. optional TEmbeddedYt EmbeddedYt_YtOption = 1 [(NYT.flags) = SERIALIZATION_YT];
  165. optional TEmbeddedYt EmbeddedYt_ProtobufOption = 2 [(NYT.flags) = SERIALIZATION_PROTOBUF];
  166. optional TEmbeddedYt EmbeddedYt_NoOption = 3;
  167. optional TEmbeddedProtobuf EmbeddedProtobuf_YtOption = 4 [(NYT.flags) = SERIALIZATION_YT];
  168. optional TEmbeddedProtobuf EmbeddedProtobuf_ProtobufOption = 5 [(NYT.flags) = SERIALIZATION_PROTOBUF];
  169. optional TEmbeddedProtobuf EmbeddedProtobuf_NoOption = 6;
  170. optional TEmbedded Embedded_YtOption = 7 [(NYT.flags) = SERIALIZATION_YT];
  171. optional TEmbedded Embedded_ProtobufOption = 8 [(NYT.flags) = SERIALIZATION_PROTOBUF];
  172. optional TEmbedded Embedded_NoOption = 9;
  173. }
  174. message TOptionalList
  175. {
  176. repeated int64 OptionalListInt64 = 1 [(NYT.flags) = OPTIONAL_LIST, (NYT.flags) = SERIALIZATION_YT];
  177. }
  178. message TPacked
  179. {
  180. repeated int64 PackedListInt64 = 1 [(NYT.flags) = SERIALIZATION_YT, packed=true];
  181. }
  182. message TCyclic
  183. {
  184. option (NYT.default_field_flags) = SERIALIZATION_YT;
  185. message TA
  186. {
  187. option (NYT.default_field_flags) = SERIALIZATION_YT;
  188. repeated TB b = 1;
  189. optional TC c = 2;
  190. }
  191. message TB
  192. {
  193. option (NYT.default_field_flags) = SERIALIZATION_YT;
  194. optional TD d = 1;
  195. }
  196. message TC
  197. {
  198. option (NYT.default_field_flags) = SERIALIZATION_YT;
  199. optional TD d = 1;
  200. }
  201. message TD
  202. {
  203. option (NYT.default_field_flags) = SERIALIZATION_YT;
  204. optional TA a = 1;
  205. }
  206. message TE
  207. {
  208. optional TD d = 1 [(NYT.flags) = SERIALIZATION_PROTOBUF];
  209. }
  210. optional TA a = 1;
  211. }
  212. message TFieldSortOrder
  213. {
  214. message TEmbeddedDefault {
  215. optional int64 x = 2;
  216. optional string y = 12;
  217. optional bool z = 1;
  218. }
  219. message TEmbeddedAsInProtoFile {
  220. option (NYT.message_flags) = DEPRECATED_SORT_FIELDS_AS_IN_PROTO_FILE;
  221. optional int64 x = 2;
  222. optional string y = 12;
  223. optional bool z = 1;
  224. }
  225. message TEmbeddedByFieldNumber {
  226. option (NYT.message_flags) = SORT_FIELDS_BY_FIELD_NUMBER;
  227. optional int64 x = 2;
  228. optional string y = 12;
  229. optional bool z = 1;
  230. }
  231. option (NYT.default_field_flags) = SERIALIZATION_YT;
  232. optional TEmbeddedDefault EmbeddedDefault = 1;
  233. optional TEmbeddedAsInProtoFile EmbeddedAsInProtoFile = 2;
  234. optional TEmbeddedByFieldNumber EmbeddedByFieldNumber = 3;
  235. }
  236. message TWithMap
  237. {
  238. option (NYT.default_field_flags) = SERIALIZATION_YT;
  239. message TEmbedded {
  240. optional int64 x = 1;
  241. optional string y = 2;
  242. }
  243. map<int64, TEmbedded> MapDefault = 1;
  244. map<int64, TEmbedded> MapListOfStructsLegacy = 2 [(NYT.flags) = MAP_AS_LIST_OF_STRUCTS_LEGACY];
  245. map<int64, TEmbedded> MapListOfStructs = 3 [(NYT.flags) = MAP_AS_LIST_OF_STRUCTS];
  246. map<int64, TEmbedded> MapOptionalDict = 4 [(NYT.flags) = MAP_AS_OPTIONAL_DICT];
  247. map<int64, TEmbedded> MapDict = 5 [(NYT.flags) = MAP_AS_DICT];
  248. }
  249. message TWithOneof
  250. {
  251. option (NYT.default_field_flags) = SERIALIZATION_YT;
  252. message TEmbedded
  253. {
  254. option (NYT.default_field_flags) = SERIALIZATION_YT;
  255. oneof Oneof {
  256. int64 x = 1;
  257. string y = 2;
  258. }
  259. }
  260. message TDefaultSeparateFields
  261. {
  262. option (NYT.default_oneof_flags) = SEPARATE_FIELDS;
  263. option (NYT.default_field_flags) = SERIALIZATION_YT;
  264. optional string field = 1;
  265. oneof Oneof2
  266. {
  267. option (NYT.variant_field_name) = "variant_field_name";
  268. option (NYT.oneof_flags) = VARIANT;
  269. string y2 = 4;
  270. TEmbedded z2 = 6;
  271. int64 x2 = 2;
  272. }
  273. oneof Oneof1
  274. {
  275. int64 x1 = 10;
  276. string y1 = 3;
  277. TEmbedded z1 = 5;
  278. }
  279. }
  280. message TNoDefault
  281. {
  282. option (NYT.default_field_flags) = SERIALIZATION_YT;
  283. optional string field = 1;
  284. oneof Oneof2
  285. {
  286. string y2 = 4;
  287. TEmbedded z2 = 6;
  288. int64 x2 = 2;
  289. }
  290. oneof Oneof1
  291. {
  292. option (NYT.oneof_flags) = SEPARATE_FIELDS;
  293. int64 x1 = 10;
  294. string y1 = 3;
  295. TEmbedded z1 = 5;
  296. }
  297. }
  298. message TSerializationProtobuf
  299. {
  300. oneof Oneof
  301. {
  302. int64 x1 = 2;
  303. string y1 = 1;
  304. TEmbedded z1 = 3;
  305. }
  306. }
  307. optional TDefaultSeparateFields DefaultSeparateFields = 1;
  308. optional TNoDefault NoDefault = 2;
  309. optional TSerializationProtobuf SerializationProtobuf = 3;
  310. oneof TopLevelOneof
  311. {
  312. int64 MemberOfTopLevelOneof = 4;
  313. }
  314. }
  315. message TEmbeddedStruct {
  316. optional float float1 = 1;
  317. optional string string1 = 2;
  318. }
  319. message TEmbedded2Message {
  320. option (NYT.default_field_flags) = SERIALIZATION_YT;
  321. optional uint64 embedded2_num = 10;
  322. optional TEmbeddedStruct embedded2_struct = 17;
  323. repeated string embedded2_repeated = 42;
  324. }
  325. message TEmbedded1Message {
  326. option (NYT.default_field_flags) = SERIALIZATION_YT;
  327. required TEmbedded2Message t2 = 1 [(NYT.flags) = EMBEDDED];
  328. oneof variant {
  329. string str_variant = 101;
  330. uint64 uint_variant = 102;
  331. }
  332. optional uint64 embedded_num = 10; // make intentional field_num collision!
  333. optional string embedded_extra_field = 11;
  334. }
  335. message TEmbeddingMessage {
  336. optional bytes other_columns_field = 15 [(NYT.flags) = OTHER_COLUMNS];
  337. required TEmbedded1Message t1 = 2 [(NYT.flags) = EMBEDDED];
  338. optional uint64 num = 12;
  339. optional string extra_field = 13;
  340. }