-
Notifications
You must be signed in to change notification settings - Fork 590
/
data.proto
151 lines (135 loc) · 3.12 KB
/
data.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
syntax = "proto3";
package data;
import "common.proto";
option java_package = "com.risingwave.proto";
option optimize_for = SPEED;
message IntervalUnit {
int32 months = 1;
int32 days = 2;
int64 ms = 3;
}
message DataType {
enum IntervalType {
UNSPECIFIED = 0;
YEAR = 1;
MONTH = 2;
DAY = 3;
HOUR = 4;
MINUTE = 5;
SECOND = 6;
YEAR_TO_MONTH = 7;
DAY_TO_HOUR = 8;
DAY_TO_MINUTE = 9;
DAY_TO_SECOND = 10;
HOUR_TO_MINUTE = 11;
HOUR_TO_SECOND = 12;
MINUTE_TO_SECOND = 13;
}
enum TypeName {
TYPE_UNSPECIFIED = 0;
INT16 = 1;
INT32 = 2;
INT64 = 3;
FLOAT = 4;
DOUBLE = 5;
BOOLEAN = 6;
VARCHAR = 7;
DECIMAL = 8;
TIME = 9;
TIMESTAMP = 10;
INTERVAL = 11;
DATE = 12;
// Timestamp type with timezone
TIMESTAMPTZ = 13;
STRUCT = 15;
LIST = 16;
BYTEA = 17;
JSONB = 18;
}
TypeName type_name = 1;
// Data length for char.
// Max data length for varchar.
// Precision for time, decimal.
uint32 precision = 2;
// Scale for decimal.
uint32 scale = 3;
bool is_nullable = 4;
IntervalType interval_type = 5;
// For struct type, it represents all the fields in the struct.
// For list type it only contains 1 element which is the inner item type of the List.
// For example, `ARRAY<INTEGER>` will be represented as `vec![DataType::Int32]`.
repeated DataType field_type = 6;
// Name of the fields if it is a struct type. For other types it will be empty.
repeated string field_names = 7;
}
message StructArrayData {
repeated Array children_array = 1;
repeated DataType children_type = 2;
}
message ListArrayData {
repeated uint32 offsets = 1;
Array value = 2;
DataType value_type = 3;
}
enum ArrayType {
UNSPECIFIED = 0;
INT16 = 1;
INT32 = 2;
INT64 = 3;
FLOAT32 = 4;
FLOAT64 = 5;
UTF8 = 6;
BOOL = 7;
DECIMAL = 8;
DATE = 9;
TIME = 10;
TIMESTAMP = 11;
INTERVAL = 12;
STRUCT = 13;
LIST = 14;
BYTEA = 15;
JSONB = 16;
SERIAL = 17;
}
message Array {
ArrayType array_type = 1;
common.Buffer null_bitmap = 2;
repeated common.Buffer values = 3;
StructArrayData struct_array_data = 4;
ListArrayData list_array_data = 5;
}
message Datum {
// bool array/bitmap: one byte, 0 for false (null), non-zero for true (non-null)
// integer, float, double: big-endianness
// interval: encoded to (months, days, milliseconds), big-endianness
// varchar: encoded accorded to encoding, currently only utf8 is supported.
bytes body = 1;
}
// New column proto def to replace fixed width column. This def
// aims to include all column type. Currently it do not support struct/array
// but capable of extending in future by add other fields.
message Column {
Array array = 2;
}
message DataChunk {
uint32 cardinality = 1;
repeated Column columns = 2;
}
enum Op {
OP_UNSPECIFIED = 0;
INSERT = 1;
DELETE = 2;
UPDATE_INSERT = 3;
UPDATE_DELETE = 4;
}
message StreamChunk {
// for Column::from_protobuf(), may not need later
uint32 cardinality = 1;
repeated Op ops = 2;
repeated Column columns = 3;
}
message Epoch {
uint64 curr = 1;
uint64 prev = 2;
}
message Terminate {}