github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/col/colserde/arrowserde/message_generated.go (about) 1 // Code generated by the FlatBuffers compiler. DO NOT EDIT. 2 3 package arrowserde 4 5 import flatbuffers "github.com/google/flatbuffers/go" 6 7 /// ---------------------------------------------------------------------- 8 /// The root Message type 9 /// This union enables us to easily send different message types without 10 /// redundant storage, and in the future we can easily add new message types. 11 /// 12 /// Arrow implementations do not need to implement all of the message types, 13 /// which may include experimental metadata types. For maximum compatibility, 14 /// it is best to send data using RecordBatch 15 type MessageHeader = byte 16 17 const ( 18 MessageHeaderNONE MessageHeader = 0 19 MessageHeaderSchema MessageHeader = 1 20 MessageHeaderDictionaryBatch MessageHeader = 2 21 MessageHeaderRecordBatch MessageHeader = 3 22 MessageHeaderTensor MessageHeader = 4 23 MessageHeaderSparseTensor MessageHeader = 5 24 ) 25 26 var EnumNamesMessageHeader = map[MessageHeader]string{ 27 MessageHeaderNONE: "NONE", 28 MessageHeaderSchema: "Schema", 29 MessageHeaderDictionaryBatch: "DictionaryBatch", 30 MessageHeaderRecordBatch: "RecordBatch", 31 MessageHeaderTensor: "Tensor", 32 MessageHeaderSparseTensor: "SparseTensor", 33 } 34 35 /// ---------------------------------------------------------------------- 36 /// Data structures for describing a table row batch (a collection of 37 /// equal-length Arrow arrays) 38 /// Metadata about a field at some level of a nested type tree (but not 39 /// its children). 40 /// 41 /// For example, a List<Int16> with values [[1, 2, 3], null, [4], [5, 6], null] 42 /// would have {length: 5, null_count: 2} for its List node, and {length: 6, 43 /// null_count: 0} for its Int16 node, as separate FieldNode structs 44 type FieldNode struct { 45 _tab flatbuffers.Struct 46 } 47 48 func (rcv *FieldNode) Init(buf []byte, i flatbuffers.UOffsetT) { 49 rcv._tab.Bytes = buf 50 rcv._tab.Pos = i 51 } 52 53 func (rcv *FieldNode) Table() flatbuffers.Table { 54 return rcv._tab.Table 55 } 56 57 /// The number of value slots in the Arrow array at this level of a nested 58 /// tree 59 func (rcv *FieldNode) Length() int64 { 60 return rcv._tab.GetInt64(rcv._tab.Pos + flatbuffers.UOffsetT(0)) 61 } 62 63 /// The number of value slots in the Arrow array at this level of a nested 64 /// tree 65 func (rcv *FieldNode) MutateLength(n int64) bool { 66 return rcv._tab.MutateInt64(rcv._tab.Pos+flatbuffers.UOffsetT(0), n) 67 } 68 69 /// The number of observed nulls. Fields with null_count == 0 may choose not 70 /// to write their physical validity bitmap out as a materialized buffer, 71 /// instead setting the length of the bitmap buffer to 0. 72 func (rcv *FieldNode) NullCount() int64 { 73 return rcv._tab.GetInt64(rcv._tab.Pos + flatbuffers.UOffsetT(8)) 74 } 75 76 /// The number of observed nulls. Fields with null_count == 0 may choose not 77 /// to write their physical validity bitmap out as a materialized buffer, 78 /// instead setting the length of the bitmap buffer to 0. 79 func (rcv *FieldNode) MutateNullCount(n int64) bool { 80 return rcv._tab.MutateInt64(rcv._tab.Pos+flatbuffers.UOffsetT(8), n) 81 } 82 83 func CreateFieldNode( 84 builder *flatbuffers.Builder, length int64, nullCount int64, 85 ) flatbuffers.UOffsetT { 86 builder.Prep(8, 16) 87 builder.PrependInt64(nullCount) 88 builder.PrependInt64(length) 89 return builder.Offset() 90 } 91 92 /// A data header describing the shared memory layout of a "record" or "row" 93 /// batch. Some systems call this a "row batch" internally and others a "record 94 /// batch". 95 type RecordBatch struct { 96 _tab flatbuffers.Table 97 } 98 99 func GetRootAsRecordBatch(buf []byte, offset flatbuffers.UOffsetT) *RecordBatch { 100 n := flatbuffers.GetUOffsetT(buf[offset:]) 101 x := &RecordBatch{} 102 x.Init(buf, n+offset) 103 return x 104 } 105 106 func (rcv *RecordBatch) Init(buf []byte, i flatbuffers.UOffsetT) { 107 rcv._tab.Bytes = buf 108 rcv._tab.Pos = i 109 } 110 111 func (rcv *RecordBatch) Table() flatbuffers.Table { 112 return rcv._tab 113 } 114 115 /// number of records / rows. The arrays in the batch should all have this 116 /// length 117 func (rcv *RecordBatch) Length() int64 { 118 o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) 119 if o != 0 { 120 return rcv._tab.GetInt64(o + rcv._tab.Pos) 121 } 122 return 0 123 } 124 125 /// number of records / rows. The arrays in the batch should all have this 126 /// length 127 func (rcv *RecordBatch) MutateLength(n int64) bool { 128 return rcv._tab.MutateInt64Slot(4, n) 129 } 130 131 /// Nodes correspond to the pre-ordered flattened logical schema 132 func (rcv *RecordBatch) Nodes(obj *FieldNode, j int) bool { 133 o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) 134 if o != 0 { 135 x := rcv._tab.Vector(o) 136 x += flatbuffers.UOffsetT(j) * 16 137 obj.Init(rcv._tab.Bytes, x) 138 return true 139 } 140 return false 141 } 142 143 func (rcv *RecordBatch) NodesLength() int { 144 o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) 145 if o != 0 { 146 return rcv._tab.VectorLen(o) 147 } 148 return 0 149 } 150 151 /// Nodes correspond to the pre-ordered flattened logical schema 152 /// Buffers correspond to the pre-ordered flattened buffer tree 153 /// 154 /// The number of buffers appended to this list depends on the schema. For 155 /// example, most primitive arrays will have 2 buffers, 1 for the validity 156 /// bitmap and 1 for the values. For struct arrays, there will only be a 157 /// single buffer for the validity (nulls) bitmap 158 func (rcv *RecordBatch) Buffers(obj *Buffer, j int) bool { 159 o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) 160 if o != 0 { 161 x := rcv._tab.Vector(o) 162 x += flatbuffers.UOffsetT(j) * 16 163 obj.Init(rcv._tab.Bytes, x) 164 return true 165 } 166 return false 167 } 168 169 func (rcv *RecordBatch) BuffersLength() int { 170 o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) 171 if o != 0 { 172 return rcv._tab.VectorLen(o) 173 } 174 return 0 175 } 176 177 /// Buffers correspond to the pre-ordered flattened buffer tree 178 /// 179 /// The number of buffers appended to this list depends on the schema. For 180 /// example, most primitive arrays will have 2 buffers, 1 for the validity 181 /// bitmap and 1 for the values. For struct arrays, there will only be a 182 /// single buffer for the validity (nulls) bitmap 183 func RecordBatchStart(builder *flatbuffers.Builder) { 184 builder.StartObject(3) 185 } 186 func RecordBatchAddLength(builder *flatbuffers.Builder, length int64) { 187 builder.PrependInt64Slot(0, length, 0) 188 } 189 func RecordBatchAddNodes(builder *flatbuffers.Builder, nodes flatbuffers.UOffsetT) { 190 builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(nodes), 0) 191 } 192 func RecordBatchStartNodesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT { 193 return builder.StartVector(16, numElems, 8) 194 } 195 func RecordBatchAddBuffers(builder *flatbuffers.Builder, buffers flatbuffers.UOffsetT) { 196 builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(buffers), 0) 197 } 198 func RecordBatchStartBuffersVector( 199 builder *flatbuffers.Builder, numElems int, 200 ) flatbuffers.UOffsetT { 201 return builder.StartVector(16, numElems, 8) 202 } 203 func RecordBatchEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { 204 return builder.EndObject() 205 } 206 207 /// For sending dictionary encoding information. Any Field can be 208 /// dictionary-encoded, but in this case none of its children may be 209 /// dictionary-encoded. 210 /// There is one vector / column per dictionary, but that vector / column 211 /// may be spread across multiple dictionary batches by using the isDelta 212 /// flag 213 type DictionaryBatch struct { 214 _tab flatbuffers.Table 215 } 216 217 func GetRootAsDictionaryBatch(buf []byte, offset flatbuffers.UOffsetT) *DictionaryBatch { 218 n := flatbuffers.GetUOffsetT(buf[offset:]) 219 x := &DictionaryBatch{} 220 x.Init(buf, n+offset) 221 return x 222 } 223 224 func (rcv *DictionaryBatch) Init(buf []byte, i flatbuffers.UOffsetT) { 225 rcv._tab.Bytes = buf 226 rcv._tab.Pos = i 227 } 228 229 func (rcv *DictionaryBatch) Table() flatbuffers.Table { 230 return rcv._tab 231 } 232 233 func (rcv *DictionaryBatch) Id() int64 { 234 o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) 235 if o != 0 { 236 return rcv._tab.GetInt64(o + rcv._tab.Pos) 237 } 238 return 0 239 } 240 241 func (rcv *DictionaryBatch) MutateId(n int64) bool { 242 return rcv._tab.MutateInt64Slot(4, n) 243 } 244 245 func (rcv *DictionaryBatch) Data(obj *RecordBatch) *RecordBatch { 246 o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) 247 if o != 0 { 248 x := rcv._tab.Indirect(o + rcv._tab.Pos) 249 if obj == nil { 250 obj = new(RecordBatch) 251 } 252 obj.Init(rcv._tab.Bytes, x) 253 return obj 254 } 255 return nil 256 } 257 258 /// If isDelta is true the values in the dictionary are to be appended to a 259 /// dictionary with the indicated id 260 func (rcv *DictionaryBatch) IsDelta() byte { 261 o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) 262 if o != 0 { 263 return rcv._tab.GetByte(o + rcv._tab.Pos) 264 } 265 return 0 266 } 267 268 /// If isDelta is true the values in the dictionary are to be appended to a 269 /// dictionary with the indicated id 270 func (rcv *DictionaryBatch) MutateIsDelta(n byte) bool { 271 return rcv._tab.MutateByteSlot(8, n) 272 } 273 274 func DictionaryBatchStart(builder *flatbuffers.Builder) { 275 builder.StartObject(3) 276 } 277 func DictionaryBatchAddId(builder *flatbuffers.Builder, id int64) { 278 builder.PrependInt64Slot(0, id, 0) 279 } 280 func DictionaryBatchAddData(builder *flatbuffers.Builder, data flatbuffers.UOffsetT) { 281 builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(data), 0) 282 } 283 func DictionaryBatchAddIsDelta(builder *flatbuffers.Builder, isDelta byte) { 284 builder.PrependByteSlot(2, isDelta, 0) 285 } 286 func DictionaryBatchEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { 287 return builder.EndObject() 288 } 289 290 type Message struct { 291 _tab flatbuffers.Table 292 } 293 294 func GetRootAsMessage(buf []byte, offset flatbuffers.UOffsetT) *Message { 295 n := flatbuffers.GetUOffsetT(buf[offset:]) 296 x := &Message{} 297 x.Init(buf, n+offset) 298 return x 299 } 300 301 func (rcv *Message) Init(buf []byte, i flatbuffers.UOffsetT) { 302 rcv._tab.Bytes = buf 303 rcv._tab.Pos = i 304 } 305 306 func (rcv *Message) Table() flatbuffers.Table { 307 return rcv._tab 308 } 309 310 func (rcv *Message) Version() int16 { 311 o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) 312 if o != 0 { 313 return rcv._tab.GetInt16(o + rcv._tab.Pos) 314 } 315 return 0 316 } 317 318 func (rcv *Message) MutateVersion(n int16) bool { 319 return rcv._tab.MutateInt16Slot(4, n) 320 } 321 322 func (rcv *Message) HeaderType() byte { 323 o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) 324 if o != 0 { 325 return rcv._tab.GetByte(o + rcv._tab.Pos) 326 } 327 return 0 328 } 329 330 func (rcv *Message) MutateHeaderType(n byte) bool { 331 return rcv._tab.MutateByteSlot(6, n) 332 } 333 334 func (rcv *Message) Header(obj *flatbuffers.Table) bool { 335 o := flatbuffers.UOffsetT(rcv._tab.Offset(8)) 336 if o != 0 { 337 rcv._tab.Union(obj, o) 338 return true 339 } 340 return false 341 } 342 343 func (rcv *Message) BodyLength() int64 { 344 o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) 345 if o != 0 { 346 return rcv._tab.GetInt64(o + rcv._tab.Pos) 347 } 348 return 0 349 } 350 351 func (rcv *Message) MutateBodyLength(n int64) bool { 352 return rcv._tab.MutateInt64Slot(10, n) 353 } 354 355 func MessageStart(builder *flatbuffers.Builder) { 356 builder.StartObject(4) 357 } 358 func MessageAddVersion(builder *flatbuffers.Builder, version int16) { 359 builder.PrependInt16Slot(0, version, 0) 360 } 361 func MessageAddHeaderType(builder *flatbuffers.Builder, headerType byte) { 362 builder.PrependByteSlot(1, headerType, 0) 363 } 364 func MessageAddHeader(builder *flatbuffers.Builder, header flatbuffers.UOffsetT) { 365 builder.PrependUOffsetTSlot(2, flatbuffers.UOffsetT(header), 0) 366 } 367 func MessageAddBodyLength(builder *flatbuffers.Builder, bodyLength int64) { 368 builder.PrependInt64Slot(3, bodyLength, 0) 369 } 370 func MessageEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { 371 return builder.EndObject() 372 }