// Code generated by array/numericbuilder.gen.go.tmpl. DO NOT EDIT.

// 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.

package array

import (
	
	
	
	
	
	

	
	
	
	
	
)

type Int64Builder struct {
	builder

	data    *memory.Buffer
	rawData []int64
}

func ( memory.Allocator) *Int64Builder {
	 := &Int64Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Int64Builder) () arrow.DataType { return arrow.PrimitiveTypes.Int64 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Int64Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Int64Builder) ( int64) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Int64Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Int64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Int64Builder) () {
	.Append(0)
}

func ( *Int64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Int64Builder) ( int64) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Int64Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Int64Builder) ( []int64,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Int64Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Int64Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Int64Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Int64Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Int64Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Int64Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Int64Traits.BytesRequired())
		.rawData = arrow.Int64Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Int64Builder) ( int) int64 {
	return .rawData[]
}

// NewArray creates a Int64 array from the memory buffers used by the builder and resets the Int64Builder
// so it can be used to build a new array.
func ( *Int64Builder) () arrow.Array {
	return .NewInt64Array()
}

// NewInt64Array creates a Int64 array from the memory buffers used by the builder and resets the Int64Builder
// so it can be used to build a new array.
func ( *Int64Builder) () ( *Int64) {
	 := .newData()
	 = NewInt64Data()
	.Release()
	return
}

func ( *Int64Builder) () ( *Data) {
	 := arrow.Int64Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Int64, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Int64Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseInt(, 10, 8*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(int64())
	return nil
}

func ( *Int64Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseInt(, 10, 8*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(int64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int64())
	case float64:
		.Append(int64())
	case json.Number:
		,  := strconv.ParseInt(.String(), 10, 8*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(int64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int64())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(int64(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Int64Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Int64Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Uint64Builder struct {
	builder

	data    *memory.Buffer
	rawData []uint64
}

func ( memory.Allocator) *Uint64Builder {
	 := &Uint64Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Uint64Builder) () arrow.DataType { return arrow.PrimitiveTypes.Uint64 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Uint64Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Uint64Builder) ( uint64) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Uint64Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Uint64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Uint64Builder) () {
	.Append(0)
}

func ( *Uint64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Uint64Builder) ( uint64) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Uint64Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Uint64Builder) ( []uint64,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Uint64Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Uint64Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Uint64Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Uint64Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Uint64Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Uint64Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Uint64Traits.BytesRequired())
		.rawData = arrow.Uint64Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Uint64Builder) ( int) uint64 {
	return .rawData[]
}

// NewArray creates a Uint64 array from the memory buffers used by the builder and resets the Uint64Builder
// so it can be used to build a new array.
func ( *Uint64Builder) () arrow.Array {
	return .NewUint64Array()
}

// NewUint64Array creates a Uint64 array from the memory buffers used by the builder and resets the Uint64Builder
// so it can be used to build a new array.
func ( *Uint64Builder) () ( *Uint64) {
	 := .newData()
	 = NewUint64Data()
	.Release()
	return
}

func ( *Uint64Builder) () ( *Data) {
	 := arrow.Uint64Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Uint64, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Uint64Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseUint(, 10, 8*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(uint64())
	return nil
}

func ( *Uint64Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseUint(, 10, 8*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(uint64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint64())
	case float64:
		.Append(uint64())
	case json.Number:
		,  := strconv.ParseUint(.String(), 10, 8*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(uint64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint64())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(uint64(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Uint64Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Uint64Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Float64Builder struct {
	builder

	data    *memory.Buffer
	rawData []float64
}

func ( memory.Allocator) *Float64Builder {
	 := &Float64Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Float64Builder) () arrow.DataType { return arrow.PrimitiveTypes.Float64 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Float64Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Float64Builder) ( float64) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Float64Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Float64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Float64Builder) () {
	.Append(0)
}

func ( *Float64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Float64Builder) ( float64) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Float64Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Float64Builder) ( []float64,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Float64Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Float64Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Float64Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Float64Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Float64Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Float64Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Float64Traits.BytesRequired())
		.rawData = arrow.Float64Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Float64Builder) ( int) float64 {
	return .rawData[]
}

// NewArray creates a Float64 array from the memory buffers used by the builder and resets the Float64Builder
// so it can be used to build a new array.
func ( *Float64Builder) () arrow.Array {
	return .NewFloat64Array()
}

// NewFloat64Array creates a Float64 array from the memory buffers used by the builder and resets the Float64Builder
// so it can be used to build a new array.
func ( *Float64Builder) () ( *Float64) {
	 := .newData()
	 = NewFloat64Data()
	.Release()
	return
}

func ( *Float64Builder) () ( *Data) {
	 := arrow.Float64Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Float64, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Float64Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseFloat(, 8*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(float64())
	return nil
}

func ( *Float64Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseFloat(, 8*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(float64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(float64())
	case float64:
		.Append(float64())
	case json.Number:
		,  := strconv.ParseFloat(.String(), 8*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(float64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(float64())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(float64(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Float64Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Float64Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Int32Builder struct {
	builder

	data    *memory.Buffer
	rawData []int32
}

func ( memory.Allocator) *Int32Builder {
	 := &Int32Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Int32Builder) () arrow.DataType { return arrow.PrimitiveTypes.Int32 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Int32Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Int32Builder) ( int32) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Int32Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Int32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Int32Builder) () {
	.Append(0)
}

func ( *Int32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Int32Builder) ( int32) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Int32Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Int32Builder) ( []int32,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Int32Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Int32Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Int32Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Int32Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Int32Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Int32Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Int32Traits.BytesRequired())
		.rawData = arrow.Int32Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Int32Builder) ( int) int32 {
	return .rawData[]
}

// NewArray creates a Int32 array from the memory buffers used by the builder and resets the Int32Builder
// so it can be used to build a new array.
func ( *Int32Builder) () arrow.Array {
	return .NewInt32Array()
}

// NewInt32Array creates a Int32 array from the memory buffers used by the builder and resets the Int32Builder
// so it can be used to build a new array.
func ( *Int32Builder) () ( *Int32) {
	 := .newData()
	 = NewInt32Data()
	.Release()
	return
}

func ( *Int32Builder) () ( *Data) {
	 := arrow.Int32Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Int32, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Int32Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseInt(, 10, 4*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(int32())
	return nil
}

func ( *Int32Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseInt(, 10, 4*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(int32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int32())
	case float64:
		.Append(int32())
	case json.Number:
		,  := strconv.ParseInt(.String(), 10, 4*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(int32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int32())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(int32(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Int32Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Int32Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Uint32Builder struct {
	builder

	data    *memory.Buffer
	rawData []uint32
}

func ( memory.Allocator) *Uint32Builder {
	 := &Uint32Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Uint32Builder) () arrow.DataType { return arrow.PrimitiveTypes.Uint32 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Uint32Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Uint32Builder) ( uint32) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Uint32Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Uint32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Uint32Builder) () {
	.Append(0)
}

func ( *Uint32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Uint32Builder) ( uint32) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Uint32Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Uint32Builder) ( []uint32,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Uint32Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Uint32Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Uint32Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Uint32Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Uint32Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Uint32Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Uint32Traits.BytesRequired())
		.rawData = arrow.Uint32Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Uint32Builder) ( int) uint32 {
	return .rawData[]
}

// NewArray creates a Uint32 array from the memory buffers used by the builder and resets the Uint32Builder
// so it can be used to build a new array.
func ( *Uint32Builder) () arrow.Array {
	return .NewUint32Array()
}

// NewUint32Array creates a Uint32 array from the memory buffers used by the builder and resets the Uint32Builder
// so it can be used to build a new array.
func ( *Uint32Builder) () ( *Uint32) {
	 := .newData()
	 = NewUint32Data()
	.Release()
	return
}

func ( *Uint32Builder) () ( *Data) {
	 := arrow.Uint32Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Uint32, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Uint32Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseUint(, 10, 4*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(uint32())
	return nil
}

func ( *Uint32Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseUint(, 10, 4*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(uint32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint32())
	case float64:
		.Append(uint32())
	case json.Number:
		,  := strconv.ParseUint(.String(), 10, 4*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(uint32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint32())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(uint32(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Uint32Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Uint32Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Float32Builder struct {
	builder

	data    *memory.Buffer
	rawData []float32
}

func ( memory.Allocator) *Float32Builder {
	 := &Float32Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Float32Builder) () arrow.DataType { return arrow.PrimitiveTypes.Float32 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Float32Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Float32Builder) ( float32) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Float32Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Float32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Float32Builder) () {
	.Append(0)
}

func ( *Float32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Float32Builder) ( float32) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Float32Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Float32Builder) ( []float32,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Float32Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Float32Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Float32Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Float32Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Float32Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Float32Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Float32Traits.BytesRequired())
		.rawData = arrow.Float32Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Float32Builder) ( int) float32 {
	return .rawData[]
}

// NewArray creates a Float32 array from the memory buffers used by the builder and resets the Float32Builder
// so it can be used to build a new array.
func ( *Float32Builder) () arrow.Array {
	return .NewFloat32Array()
}

// NewFloat32Array creates a Float32 array from the memory buffers used by the builder and resets the Float32Builder
// so it can be used to build a new array.
func ( *Float32Builder) () ( *Float32) {
	 := .newData()
	 = NewFloat32Data()
	.Release()
	return
}

func ( *Float32Builder) () ( *Data) {
	 := arrow.Float32Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Float32, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Float32Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseFloat(, 4*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(float32())
	return nil
}

func ( *Float32Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseFloat(, 4*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(float32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(float32())
	case float64:
		.Append(float32())
	case json.Number:
		,  := strconv.ParseFloat(.String(), 4*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(float32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(float32())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(float32(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Float32Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Float32Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Int16Builder struct {
	builder

	data    *memory.Buffer
	rawData []int16
}

func ( memory.Allocator) *Int16Builder {
	 := &Int16Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Int16Builder) () arrow.DataType { return arrow.PrimitiveTypes.Int16 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Int16Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Int16Builder) ( int16) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Int16Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Int16Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Int16Builder) () {
	.Append(0)
}

func ( *Int16Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Int16Builder) ( int16) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Int16Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Int16Builder) ( []int16,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Int16Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Int16Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Int16Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Int16Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Int16Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Int16Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Int16Traits.BytesRequired())
		.rawData = arrow.Int16Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Int16Builder) ( int) int16 {
	return .rawData[]
}

// NewArray creates a Int16 array from the memory buffers used by the builder and resets the Int16Builder
// so it can be used to build a new array.
func ( *Int16Builder) () arrow.Array {
	return .NewInt16Array()
}

// NewInt16Array creates a Int16 array from the memory buffers used by the builder and resets the Int16Builder
// so it can be used to build a new array.
func ( *Int16Builder) () ( *Int16) {
	 := .newData()
	 = NewInt16Data()
	.Release()
	return
}

func ( *Int16Builder) () ( *Data) {
	 := arrow.Int16Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Int16, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Int16Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseInt(, 10, 2*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(int16())
	return nil
}

func ( *Int16Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseInt(, 10, 2*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(int16(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int16())
	case float64:
		.Append(int16())
	case json.Number:
		,  := strconv.ParseInt(.String(), 10, 2*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(int16(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int16())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(int16(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Int16Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Int16Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Uint16Builder struct {
	builder

	data    *memory.Buffer
	rawData []uint16
}

func ( memory.Allocator) *Uint16Builder {
	 := &Uint16Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Uint16Builder) () arrow.DataType { return arrow.PrimitiveTypes.Uint16 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Uint16Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Uint16Builder) ( uint16) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Uint16Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Uint16Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Uint16Builder) () {
	.Append(0)
}

func ( *Uint16Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Uint16Builder) ( uint16) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Uint16Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Uint16Builder) ( []uint16,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Uint16Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Uint16Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Uint16Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Uint16Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Uint16Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Uint16Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Uint16Traits.BytesRequired())
		.rawData = arrow.Uint16Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Uint16Builder) ( int) uint16 {
	return .rawData[]
}

// NewArray creates a Uint16 array from the memory buffers used by the builder and resets the Uint16Builder
// so it can be used to build a new array.
func ( *Uint16Builder) () arrow.Array {
	return .NewUint16Array()
}

// NewUint16Array creates a Uint16 array from the memory buffers used by the builder and resets the Uint16Builder
// so it can be used to build a new array.
func ( *Uint16Builder) () ( *Uint16) {
	 := .newData()
	 = NewUint16Data()
	.Release()
	return
}

func ( *Uint16Builder) () ( *Data) {
	 := arrow.Uint16Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Uint16, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Uint16Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseUint(, 10, 2*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(uint16())
	return nil
}

func ( *Uint16Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseUint(, 10, 2*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(uint16(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint16())
	case float64:
		.Append(uint16())
	case json.Number:
		,  := strconv.ParseUint(.String(), 10, 2*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(uint16(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint16())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(uint16(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Uint16Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Uint16Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Int8Builder struct {
	builder

	data    *memory.Buffer
	rawData []int8
}

func ( memory.Allocator) *Int8Builder {
	 := &Int8Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Int8Builder) () arrow.DataType { return arrow.PrimitiveTypes.Int8 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Int8Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Int8Builder) ( int8) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Int8Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Int8Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Int8Builder) () {
	.Append(0)
}

func ( *Int8Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Int8Builder) ( int8) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Int8Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Int8Builder) ( []int8,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Int8Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Int8Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Int8Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Int8Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Int8Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Int8Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Int8Traits.BytesRequired())
		.rawData = arrow.Int8Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Int8Builder) ( int) int8 {
	return .rawData[]
}

// NewArray creates a Int8 array from the memory buffers used by the builder and resets the Int8Builder
// so it can be used to build a new array.
func ( *Int8Builder) () arrow.Array {
	return .NewInt8Array()
}

// NewInt8Array creates a Int8 array from the memory buffers used by the builder and resets the Int8Builder
// so it can be used to build a new array.
func ( *Int8Builder) () ( *Int8) {
	 := .newData()
	 = NewInt8Data()
	.Release()
	return
}

func ( *Int8Builder) () ( *Data) {
	 := arrow.Int8Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Int8, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Int8Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseInt(, 10, 1*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(int8())
	return nil
}

func ( *Int8Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseInt(, 10, 1*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(int8(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int8())
	case float64:
		.Append(int8())
	case json.Number:
		,  := strconv.ParseInt(.String(), 10, 1*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(int8(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(int8())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(int8(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Int8Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Int8Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Uint8Builder struct {
	builder

	data    *memory.Buffer
	rawData []uint8
}

func ( memory.Allocator) *Uint8Builder {
	 := &Uint8Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Uint8Builder) () arrow.DataType { return arrow.PrimitiveTypes.Uint8 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Uint8Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Uint8Builder) ( uint8) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Uint8Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Uint8Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Uint8Builder) () {
	.Append(0)
}

func ( *Uint8Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Uint8Builder) ( uint8) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Uint8Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Uint8Builder) ( []uint8,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Uint8Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Uint8Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Uint8Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Uint8Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Uint8Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Uint8Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Uint8Traits.BytesRequired())
		.rawData = arrow.Uint8Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Uint8Builder) ( int) uint8 {
	return .rawData[]
}

// NewArray creates a Uint8 array from the memory buffers used by the builder and resets the Uint8Builder
// so it can be used to build a new array.
func ( *Uint8Builder) () arrow.Array {
	return .NewUint8Array()
}

// NewUint8Array creates a Uint8 array from the memory buffers used by the builder and resets the Uint8Builder
// so it can be used to build a new array.
func ( *Uint8Builder) () ( *Uint8) {
	 := .newData()
	 = NewUint8Data()
	.Release()
	return
}

func ( *Uint8Builder) () ( *Data) {
	 := arrow.Uint8Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Uint8, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Uint8Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseUint(, 10, 1*8)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(uint8())
	return nil
}

func ( *Uint8Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()

	case string:
		,  := strconv.ParseUint(, 10, 1*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(uint8(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint8())
	case float64:
		.Append(uint8())
	case json.Number:
		,  := strconv.ParseUint(.String(), 10, 1*8)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(uint8(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(uint8())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(uint8(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Uint8Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Uint8Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Time32Builder struct {
	builder

	dtype   *arrow.Time32Type
	data    *memory.Buffer
	rawData []arrow.Time32
}

func ( memory.Allocator,  *arrow.Time32Type) *Time32Builder {
	 := &Time32Builder{builder: builder{mem: }, dtype: }
	.refCount.Add(1)
	return 
}

func ( *Time32Builder) () arrow.DataType { return .dtype }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Time32Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Time32Builder) ( arrow.Time32) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Time32Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Time32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Time32Builder) () {
	.Append(0)
}

func ( *Time32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Time32Builder) ( arrow.Time32) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Time32Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Time32Builder) ( []arrow.Time32,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Time32Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Time32Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Time32Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Time32Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Time32Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Time32Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Time32Traits.BytesRequired())
		.rawData = arrow.Time32Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Time32Builder) ( int) arrow.Time32 {
	return .rawData[]
}

// NewArray creates a Time32 array from the memory buffers used by the builder and resets the Time32Builder
// so it can be used to build a new array.
func ( *Time32Builder) () arrow.Array {
	return .NewTime32Array()
}

// NewTime32Array creates a Time32 array from the memory buffers used by the builder and resets the Time32Builder
// so it can be used to build a new array.
func ( *Time32Builder) () ( *Time32) {
	 := .newData()
	 = NewTime32Data()
	.Release()
	return
}

func ( *Time32Builder) () ( *Data) {
	 := arrow.Time32Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(.dtype, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Time32Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := arrow.Time32FromString(, .dtype.Unit)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append()
	return nil
}

func ( *Time32Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()
	case string:
		,  := arrow.Time32FromString(, .dtype.Unit)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(arrow.Time32(0)),
				Offset: .InputOffset(),
			}
		}

		.Append()
	case json.Number:
		,  := .Int64()
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(arrow.Time32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(arrow.Time32())
	case float64:
		.Append(arrow.Time32())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(arrow.Time32(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Time32Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Time32Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Time64Builder struct {
	builder

	dtype   *arrow.Time64Type
	data    *memory.Buffer
	rawData []arrow.Time64
}

func ( memory.Allocator,  *arrow.Time64Type) *Time64Builder {
	 := &Time64Builder{builder: builder{mem: }, dtype: }
	.refCount.Add(1)
	return 
}

func ( *Time64Builder) () arrow.DataType { return .dtype }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Time64Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Time64Builder) ( arrow.Time64) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Time64Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Time64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Time64Builder) () {
	.Append(0)
}

func ( *Time64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Time64Builder) ( arrow.Time64) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Time64Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Time64Builder) ( []arrow.Time64,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Time64Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Time64Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Time64Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Time64Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Time64Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Time64Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Time64Traits.BytesRequired())
		.rawData = arrow.Time64Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Time64Builder) ( int) arrow.Time64 {
	return .rawData[]
}

// NewArray creates a Time64 array from the memory buffers used by the builder and resets the Time64Builder
// so it can be used to build a new array.
func ( *Time64Builder) () arrow.Array {
	return .NewTime64Array()
}

// NewTime64Array creates a Time64 array from the memory buffers used by the builder and resets the Time64Builder
// so it can be used to build a new array.
func ( *Time64Builder) () ( *Time64) {
	 := .newData()
	 = NewTime64Data()
	.Release()
	return
}

func ( *Time64Builder) () ( *Data) {
	 := arrow.Time64Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(.dtype, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Time64Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := arrow.Time64FromString(, .dtype.Unit)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append()
	return nil
}

func ( *Time64Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()
	case string:
		,  := arrow.Time64FromString(, .dtype.Unit)
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(arrow.Time64(0)),
				Offset: .InputOffset(),
			}
		}

		.Append()
	case json.Number:
		,  := .Int64()
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(arrow.Time64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(arrow.Time64())
	case float64:
		.Append(arrow.Time64())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(arrow.Time64(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Time64Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Time64Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Date32Builder struct {
	builder

	data    *memory.Buffer
	rawData []arrow.Date32
}

func ( memory.Allocator) *Date32Builder {
	 := &Date32Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Date32Builder) () arrow.DataType { return arrow.PrimitiveTypes.Date32 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Date32Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Date32Builder) ( arrow.Date32) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Date32Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Date32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Date32Builder) () {
	.Append(0)
}

func ( *Date32Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Date32Builder) ( arrow.Date32) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Date32Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Date32Builder) ( []arrow.Date32,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Date32Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Date32Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Date32Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Date32Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Date32Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Date32Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Date32Traits.BytesRequired())
		.rawData = arrow.Date32Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Date32Builder) ( int) arrow.Date32 {
	return .rawData[]
}

// NewArray creates a Date32 array from the memory buffers used by the builder and resets the Date32Builder
// so it can be used to build a new array.
func ( *Date32Builder) () arrow.Array {
	return .NewDate32Array()
}

// NewDate32Array creates a Date32 array from the memory buffers used by the builder and resets the Date32Builder
// so it can be used to build a new array.
func ( *Date32Builder) () ( *Date32) {
	 := .newData()
	 = NewDate32Data()
	.Release()
	return
}

func ( *Date32Builder) () ( *Data) {
	 := arrow.Date32Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Date32, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Date32Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := time.Parse("2006-01-02", )
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(arrow.Date32FromTime())
	return nil
}

func ( *Date32Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()
	case string:
		,  := time.Parse("2006-01-02", )
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(arrow.Date32(0)),
				Offset: .InputOffset(),
			}
		}

		.Append(arrow.Date32FromTime())
	case json.Number:
		,  := .Int64()
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(arrow.Date32(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(arrow.Date32())
	case float64:
		.Append(arrow.Date32())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(arrow.Date32(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Date32Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Date32Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type Date64Builder struct {
	builder

	data    *memory.Buffer
	rawData []arrow.Date64
}

func ( memory.Allocator) *Date64Builder {
	 := &Date64Builder{builder: builder{mem: }}
	.refCount.Add(1)
	return 
}

func ( *Date64Builder) () arrow.DataType { return arrow.PrimitiveTypes.Date64 }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *Date64Builder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *Date64Builder) ( arrow.Date64) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *Date64Builder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *Date64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *Date64Builder) () {
	.Append(0)
}

func ( *Date64Builder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *Date64Builder) ( arrow.Date64) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *Date64Builder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *Date64Builder) ( []arrow.Date64,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.Date64Traits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *Date64Builder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.Date64Traits.BytesRequired()
	.data.Resize()
	.rawData = arrow.Date64Traits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *Date64Builder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *Date64Builder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.Date64Traits.BytesRequired())
		.rawData = arrow.Date64Traits.CastFromBytes(.data.Bytes())
	}
}

func ( *Date64Builder) ( int) arrow.Date64 {
	return .rawData[]
}

// NewArray creates a Date64 array from the memory buffers used by the builder and resets the Date64Builder
// so it can be used to build a new array.
func ( *Date64Builder) () arrow.Array {
	return .NewDate64Array()
}

// NewDate64Array creates a Date64 array from the memory buffers used by the builder and resets the Date64Builder
// so it can be used to build a new array.
func ( *Date64Builder) () ( *Date64) {
	 := .newData()
	 = NewDate64Data()
	.Release()
	return
}

func ( *Date64Builder) () ( *Data) {
	 := arrow.Date64Traits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(arrow.PrimitiveTypes.Date64, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *Date64Builder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := time.Parse("2006-01-02", )
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(arrow.Date64FromTime())
	return nil
}

func ( *Date64Builder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()
	case string:
		,  := time.Parse("2006-01-02", )
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(arrow.Date64(0)),
				Offset: .InputOffset(),
			}
		}

		.Append(arrow.Date64FromTime())
	case json.Number:
		,  := .Int64()
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(arrow.Date64(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(arrow.Date64())
	case float64:
		.Append(arrow.Date64())

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(arrow.Date64(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *Date64Builder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *Date64Builder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

type DurationBuilder struct {
	builder

	dtype   *arrow.DurationType
	data    *memory.Buffer
	rawData []arrow.Duration
}

func ( memory.Allocator,  *arrow.DurationType) *DurationBuilder {
	 := &DurationBuilder{builder: builder{mem: }, dtype: }
	.refCount.Add(1)
	return 
}

func ( *DurationBuilder) () arrow.DataType { return .dtype }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *DurationBuilder) () {
	debug.Assert(.refCount.Load() > 0, "too many releases")

	if .refCount.Add(-1) == 0 {
		if .nullBitmap != nil {
			.nullBitmap.Release()
			.nullBitmap = nil
		}
		if .data != nil {
			.data.Release()
			.data = nil
			.rawData = nil
		}
	}
}

func ( *DurationBuilder) ( arrow.Duration) {
	.Reserve(1)
	.UnsafeAppend()
}

func ( *DurationBuilder) () {
	.Reserve(1)
	.UnsafeAppendBoolToBitmap(false)
}

func ( *DurationBuilder) ( int) {
	for  := 0;  < ; ++ {
		.AppendNull()
	}
}

func ( *DurationBuilder) () {
	.Append(0)
}

func ( *DurationBuilder) ( int) {
	for  := 0;  < ; ++ {
		.AppendEmptyValue()
	}
}

func ( *DurationBuilder) ( arrow.Duration) {
	bitutil.SetBit(.nullBitmap.Bytes(), .length)
	.rawData[.length] = 
	.length++
}

func ( *DurationBuilder) ( bool) {
	if  {
		bitutil.SetBit(.nullBitmap.Bytes(), .length)
	} else {
		.nulls++
	}
	.length++
}

// AppendValues will append the values in the v slice. The valid slice determines which values
// in v are valid (not null). The valid slice must either be empty or be equal in length to v. If empty,
// all values in v are appended and considered valid.
func ( *DurationBuilder) ( []arrow.Duration,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

	.Reserve(len())
	arrow.DurationTraits.Copy(.rawData[.length:], )
	.builder.unsafeAppendBoolsToBitmap(, len())
}

func ( *DurationBuilder) ( int) {
	.builder.init()

	.data = memory.NewResizableBuffer(.mem)
	 := arrow.DurationTraits.BytesRequired()
	.data.Resize()
	.rawData = arrow.DurationTraits.CastFromBytes(.data.Bytes())
}

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *DurationBuilder) ( int) {
	.builder.reserve(, .Resize)
}

// Resize adjusts the space allocated by b to n elements. If n is greater than b.Cap(),
// additional memory will be allocated. If n is smaller, the allocated memory may reduced.
func ( *DurationBuilder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

	if .capacity == 0 {
		.init()
	} else {
		.builder.resize(, .init)
		.data.Resize(arrow.DurationTraits.BytesRequired())
		.rawData = arrow.DurationTraits.CastFromBytes(.data.Bytes())
	}
}

func ( *DurationBuilder) ( int) arrow.Duration {
	return .rawData[]
}

// NewArray creates a Duration array from the memory buffers used by the builder and resets the DurationBuilder
// so it can be used to build a new array.
func ( *DurationBuilder) () arrow.Array {
	return .NewDurationArray()
}

// NewDurationArray creates a Duration array from the memory buffers used by the builder and resets the DurationBuilder
// so it can be used to build a new array.
func ( *DurationBuilder) () ( *Duration) {
	 := .newData()
	 = NewDurationData()
	.Release()
	return
}

func ( *DurationBuilder) () ( *Data) {
	 := arrow.DurationTraits.BytesRequired(.length)
	if  > 0 &&  < .data.Len() {
		// trim buffers
		.data.Resize()
	}
	 = NewData(.dtype, .length, []*memory.Buffer{.nullBitmap, .data}, nil, .nulls, 0)
	.reset()

	if .data != nil {
		.data.Release()
		.data = nil
		.rawData = nil
	}

	return
}

func ( *DurationBuilder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := time.ParseDuration()
	if  != nil {
		return 
	}

	.Append(arrow.Duration( / .dtype.Unit.Multiplier()))
	return nil
}

func ( *DurationBuilder) ( *json.Decoder) error {
	,  := .Token()
	if  != nil {
		return 
	}

	switch v := .(type) {
	case nil:
		.AppendNull()
	case json.Number:
		,  := .Int64()
		if  != nil {
			return &json.UnmarshalTypeError{
				Value:  .String(),
				Type:   reflect.TypeOf(arrow.Duration(0)),
				Offset: .InputOffset(),
			}
		}
		.Append(arrow.Duration())
	case float64:
		.Append(arrow.Duration())
	case string:
		// be flexible for specifying durations by accepting forms like
		// 3h2m0.5s regardless of the unit and converting it to the proper
		// precision.
		,  := time.ParseDuration()
		if  != nil {
			// if we got an error, maybe it was because the attempt to create
			// a time.Duration (int64) in nanoseconds would overflow. check if
			// the string is just a large number followed by the unit suffix
			if strings.HasSuffix(, .dtype.Unit.String()) {
				,  := strconv.ParseInt([:len()-len(.dtype.Unit.String())], 10, 64)
				if  == nil {
					.Append(arrow.Duration())
					break
				}
			}

			return &json.UnmarshalTypeError{
				Value:  ,
				Type:   reflect.TypeOf(arrow.Duration(0)),
				Offset: .InputOffset(),
			}
		}

		switch .dtype.Unit {
		case arrow.Nanosecond:
			.Append(arrow.Duration(.Nanoseconds()))
		case arrow.Microsecond:
			.Append(arrow.Duration(.Microseconds()))
		case arrow.Millisecond:
			.Append(arrow.Duration(.Milliseconds()))
		case arrow.Second:
			.Append(arrow.Duration(.Seconds()))
		}

	default:
		return &json.UnmarshalTypeError{
			Value:  fmt.Sprint(),
			Type:   reflect.TypeOf(arrow.Duration(0)),
			Offset: .InputOffset(),
		}
	}

	return nil
}

func ( *DurationBuilder) ( *json.Decoder) error {
	for .More() {
		if  := .UnmarshalOne();  != nil {
			return 
		}
	}
	return nil
}

func ( *DurationBuilder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

	if ,  := .(json.Delim); ! ||  != '[' {
		return fmt.Errorf("binary builder must unpack from json array, found %s", )
	}

	return .Unmarshal()
}

var (
	_ Builder = (*Int64Builder)(nil)
	_ Builder = (*Uint64Builder)(nil)
	_ Builder = (*Float64Builder)(nil)
	_ Builder = (*Int32Builder)(nil)
	_ Builder = (*Uint32Builder)(nil)
	_ Builder = (*Float32Builder)(nil)
	_ Builder = (*Int16Builder)(nil)
	_ Builder = (*Uint16Builder)(nil)
	_ Builder = (*Int8Builder)(nil)
	_ Builder = (*Uint8Builder)(nil)
	_ Builder = (*Time32Builder)(nil)
	_ Builder = (*Time64Builder)(nil)
	_ Builder = (*Date32Builder)(nil)
	_ Builder = (*Date64Builder)(nil)
	_ Builder = (*DurationBuilder)(nil)
)