From ecd953c8b9244b6327483f907803466c83448150 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Tue, 21 May 2019 10:16:29 +0200 Subject: [PATCH] ARROW-5383: [Go] Update flatbuf for new Duration type --- go/arrow/internal/flatbuf/Duration.go | 65 +++++++++++++++++++++++++++ go/arrow/internal/flatbuf/Field.go | 18 ++++++-- go/arrow/internal/flatbuf/Type.go | 2 + 3 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 go/arrow/internal/flatbuf/Duration.go diff --git a/go/arrow/internal/flatbuf/Duration.go b/go/arrow/internal/flatbuf/Duration.go new file mode 100644 index 000000000000..4bb44d2ec032 --- /dev/null +++ b/go/arrow/internal/flatbuf/Duration.go @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by the FlatBuffers compiler. DO NOT EDIT. + +package flatbuf + +import ( + flatbuffers "github.com/google/flatbuffers/go" +) + +type Duration struct { + _tab flatbuffers.Table +} + +func GetRootAsDuration(buf []byte, offset flatbuffers.UOffsetT) *Duration { + n := flatbuffers.GetUOffsetT(buf[offset:]) + x := &Duration{} + x.Init(buf, n+offset) + return x +} + +func (rcv *Duration) Init(buf []byte, i flatbuffers.UOffsetT) { + rcv._tab.Bytes = buf + rcv._tab.Pos = i +} + +func (rcv *Duration) Table() flatbuffers.Table { + return rcv._tab +} + +func (rcv *Duration) Unit() TimeUnit { + o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) + if o != 0 { + return rcv._tab.GetInt16(o + rcv._tab.Pos) + } + return 1 +} + +func (rcv *Duration) MutateUnit(n TimeUnit) bool { + return rcv._tab.MutateInt16Slot(4, n) +} + +func DurationStart(builder *flatbuffers.Builder) { + builder.StartObject(1) +} +func DurationAddUnit(builder *flatbuffers.Builder, unit int16) { + builder.PrependInt16Slot(0, unit, 1) +} +func DurationEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT { + return builder.EndObject() +} diff --git a/go/arrow/internal/flatbuf/Field.go b/go/arrow/internal/flatbuf/Field.go index 67ac3df5f473..d63df246b715 100644 --- a/go/arrow/internal/flatbuf/Field.go +++ b/go/arrow/internal/flatbuf/Field.go @@ -25,10 +25,6 @@ import ( /// ---------------------------------------------------------------------- /// A field represents a named column in a record / row batch or child of a /// nested type. -/// -/// - children is only for nested Arrow arrays -/// - For primitive types, children will have length 0 -/// - nullable should default to true in general type Field struct { _tab flatbuffers.Table } @@ -49,6 +45,7 @@ func (rcv *Field) Table() flatbuffers.Table { return rcv._tab } +/// Name is not required, in i.e. a List func (rcv *Field) Name() []byte { o := flatbuffers.UOffsetT(rcv._tab.Offset(4)) if o != 0 { @@ -57,6 +54,8 @@ func (rcv *Field) Name() []byte { return nil } +/// Name is not required, in i.e. a List +/// Whether or not this field can contain nulls. Should be true in general. func (rcv *Field) Nullable() bool { o := flatbuffers.UOffsetT(rcv._tab.Offset(6)) if o != 0 { @@ -65,6 +64,7 @@ func (rcv *Field) Nullable() bool { return false } +/// Whether or not this field can contain nulls. Should be true in general. func (rcv *Field) MutateNullable(n bool) bool { return rcv._tab.MutateBoolSlot(6, n) } @@ -81,6 +81,7 @@ func (rcv *Field) MutateTypeType(n byte) bool { return rcv._tab.MutateByteSlot(8, n) } +/// This is the type of the decoded value if the field is dictionary encoded. func (rcv *Field) Type(obj *flatbuffers.Table) bool { o := flatbuffers.UOffsetT(rcv._tab.Offset(10)) if o != 0 { @@ -90,6 +91,8 @@ func (rcv *Field) Type(obj *flatbuffers.Table) bool { return false } +/// This is the type of the decoded value if the field is dictionary encoded. +/// Present only if the field is dictionary encoded. func (rcv *Field) Dictionary(obj *DictionaryEncoding) *DictionaryEncoding { o := flatbuffers.UOffsetT(rcv._tab.Offset(12)) if o != 0 { @@ -103,6 +106,9 @@ func (rcv *Field) Dictionary(obj *DictionaryEncoding) *DictionaryEncoding { return nil } +/// Present only if the field is dictionary encoded. +/// children apply only to nested data types like Struct, List and Union. For +/// primitive types children will have length 0. func (rcv *Field) Children(obj *Field, j int) bool { o := flatbuffers.UOffsetT(rcv._tab.Offset(14)) if o != 0 { @@ -123,6 +129,9 @@ func (rcv *Field) ChildrenLength() int { return 0 } +/// children apply only to nested data types like Struct, List and Union. For +/// primitive types children will have length 0. +/// User-defined metadata func (rcv *Field) CustomMetadata(obj *KeyValue, j int) bool { o := flatbuffers.UOffsetT(rcv._tab.Offset(16)) if o != 0 { @@ -143,6 +152,7 @@ func (rcv *Field) CustomMetadataLength() int { return 0 } +/// User-defined metadata func FieldStart(builder *flatbuffers.Builder) { builder.StartObject(7) } diff --git a/go/arrow/internal/flatbuf/Type.go b/go/arrow/internal/flatbuf/Type.go index c8bb7f849ab5..6fcbd25ce88c 100644 --- a/go/arrow/internal/flatbuf/Type.go +++ b/go/arrow/internal/flatbuf/Type.go @@ -41,6 +41,7 @@ const ( TypeFixedSizeBinary Type = 15 TypeFixedSizeList Type = 16 TypeMap Type = 17 + TypeDuration Type = 18 ) var EnumNamesType = map[Type]string{ @@ -62,5 +63,6 @@ var EnumNamesType = map[Type]string{ TypeFixedSizeBinary:"FixedSizeBinary", TypeFixedSizeList:"FixedSizeList", TypeMap:"Map", + TypeDuration:"Duration", }