mq_schema.proto 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. syntax = "proto3";
  2. package schema_pb;
  3. option go_package = "github.com/seaweedfs/seaweedfs/weed/pb/schema_pb";
  4. ///////////////////////////
  5. // Topic definition
  6. ///////////////////////////
  7. message Topic {
  8. string namespace = 1;
  9. string name = 2;
  10. }
  11. message Partition {
  12. int32 ring_size = 1;
  13. int32 range_start = 2;
  14. int32 range_stop = 3;
  15. int64 unix_time_ns = 4;
  16. }
  17. message Offset {
  18. Topic topic = 1;
  19. repeated PartitionOffset partition_offsets = 2;
  20. }
  21. enum OffsetType {
  22. RESUME_OR_EARLIEST = 0;
  23. RESET_TO_EARLIEST = 5;
  24. EXACT_TS_NS = 10;
  25. RESET_TO_LATEST = 15;
  26. RESUME_OR_LATEST = 20;
  27. }
  28. message PartitionOffset {
  29. Partition partition = 1;
  30. int64 start_ts_ns = 2;
  31. }
  32. ///////////////////////////
  33. // schema definition
  34. ///////////////////////////
  35. message RecordType {
  36. repeated Field fields = 1;
  37. }
  38. message Field {
  39. string name = 1;
  40. int32 field_index = 2;
  41. Type type = 3;
  42. bool is_repeated = 4;
  43. bool is_required = 5;
  44. }
  45. message Type {
  46. oneof kind {
  47. ScalarType scalar_type = 1;
  48. RecordType record_type = 2;
  49. ListType list_type = 3;
  50. }
  51. }
  52. enum ScalarType {
  53. BOOL = 0;
  54. INT32 = 1;
  55. INT64 = 3;
  56. FLOAT = 4;
  57. DOUBLE = 5;
  58. BYTES = 6;
  59. STRING = 7;
  60. // Parquet logical types for analytics
  61. TIMESTAMP = 8; // UTC timestamp (microseconds since epoch)
  62. DATE = 9; // Date (days since epoch)
  63. DECIMAL = 10; // Arbitrary precision decimal
  64. TIME = 11; // Time of day (microseconds)
  65. }
  66. message ListType {
  67. Type element_type = 1;
  68. }
  69. ///////////////////////////
  70. // value definition
  71. ///////////////////////////
  72. message RecordValue {
  73. map<string, Value> fields = 1;
  74. }
  75. message Value {
  76. oneof kind {
  77. bool bool_value = 1;
  78. int32 int32_value = 2;
  79. int64 int64_value = 3;
  80. float float_value = 4;
  81. double double_value = 5;
  82. bytes bytes_value = 6;
  83. string string_value = 7;
  84. // Parquet logical type values
  85. TimestampValue timestamp_value = 8;
  86. DateValue date_value = 9;
  87. DecimalValue decimal_value = 10;
  88. TimeValue time_value = 11;
  89. // Complex types
  90. ListValue list_value = 14;
  91. RecordValue record_value = 15;
  92. }
  93. }
  94. // Parquet logical type value messages
  95. message TimestampValue {
  96. int64 timestamp_micros = 1; // Microseconds since Unix epoch (UTC)
  97. bool is_utc = 2; // True if UTC, false if local time
  98. }
  99. message DateValue {
  100. int32 days_since_epoch = 1; // Days since Unix epoch (1970-01-01)
  101. }
  102. message DecimalValue {
  103. bytes value = 1; // Arbitrary precision decimal as bytes
  104. int32 precision = 2; // Total number of digits
  105. int32 scale = 3; // Number of digits after decimal point
  106. }
  107. message TimeValue {
  108. int64 time_micros = 1; // Microseconds since midnight
  109. }
  110. message ListValue {
  111. repeated Value values = 1;
  112. }