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

	
	
	
	
	
)

func ( arrow.ArrayData) arrow.Array {
	switch .DataType().(type) {
	case *arrow.MonthIntervalType:
		return NewMonthIntervalData(.(*Data))
	case *arrow.DayTimeIntervalType:
		return NewDayTimeIntervalData(.(*Data))
	case *arrow.MonthDayNanoIntervalType:
		return NewMonthDayNanoIntervalData(.(*Data))
	default:
		panic(fmt.Errorf("arrow/array: unknown interval data type %T", .DataType()))
	}
}

// A type which represents an immutable sequence of arrow.MonthInterval values.
type MonthInterval struct {
	array
	values []arrow.MonthInterval
}

func ( arrow.ArrayData) *MonthInterval {
	 := &MonthInterval{}
	.refCount.Add(1)
	.setData(.(*Data))
	return 
}

func ( *MonthInterval) ( int) arrow.MonthInterval { return .values[] }
func ( *MonthInterval) ( int) string {
	if .IsNull() {
		return NullValueStr
	}
	return fmt.Sprintf("%v", .Value())
}
func ( *MonthInterval) () []arrow.MonthInterval { return .Values() }
func ( *MonthInterval) () []arrow.MonthInterval              { return .values }

func ( *MonthInterval) () string {
	 := new(strings.Builder)
	.WriteString("[")
	for ,  := range .values {
		if  > 0 {
			fmt.Fprintf(, " ")
		}
		switch {
		case .IsNull():
			.WriteString(NullValueStr)
		default:
			fmt.Fprintf(, "%v", )
		}
	}
	.WriteString("]")
	return .String()
}

func ( *MonthInterval) ( *Data) {
	.array.setData()
	 := .buffers[1]
	if  != nil {
		.values = arrow.MonthIntervalTraits.CastFromBytes(.Bytes())
		 := .data.offset
		 :=  + .data.length
		.values = .values[:]
	}
}

func ( *MonthInterval) ( int) interface{} {
	if .IsValid() {
		return .values[]
	}
	return nil
}

// MarshalJSON will create a json array out of a MonthInterval array,
// each value will be an object of the form {"months": #} where
// # is the numeric value of that index
func ( *MonthInterval) () ([]byte, error) {
	if .NullN() == 0 {
		return json.Marshal(.values)
	}
	 := make([]interface{}, .Len())
	for  := 0;  < .Len(); ++ {
		if .IsValid() {
			[] = .values[]
		} else {
			[] = nil
		}
	}

	return json.Marshal()
}

func arrayEqualMonthInterval(,  *MonthInterval) bool {
	for  := 0;  < .Len(); ++ {
		if .IsNull() {
			continue
		}
		if .Value() != .Value() {
			return false
		}
	}
	return true
}

type MonthIntervalBuilder struct {
	builder

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

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

func ( *MonthIntervalBuilder) () arrow.DataType { return arrow.FixedWidthTypes.MonthInterval }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *MonthIntervalBuilder) () {
	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 ( *MonthIntervalBuilder) ( arrow.MonthInterval) {
	.Reserve(1)
	.UnsafeAppend()
}

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

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

func ( *MonthIntervalBuilder) () {
	.Append(arrow.MonthInterval(0))
}

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

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

func ( *MonthIntervalBuilder) ( 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 ( *MonthIntervalBuilder) ( []arrow.MonthInterval,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

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

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

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

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *MonthIntervalBuilder) ( int) {
	.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 ( *MonthIntervalBuilder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

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

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

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

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

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

	return
}

func ( *MonthIntervalBuilder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	,  := strconv.ParseInt(, 10, 32)
	if  != nil {
		.AppendNull()
		return 
	}
	.Append(arrow.MonthInterval())
	return nil
}

func ( *MonthIntervalBuilder) ( *json.Decoder) error {
	var  *arrow.MonthInterval
	if  := .Decode(&);  != nil {
		return 
	}

	if  == nil {
		.AppendNull()
	} else {
		.Append(*)
	}
	return nil
}

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

// UnmarshalJSON will add the unmarshalled values of an array to the builder,
// values are expected to be strings of the form "#months" where # is the int32
// value that will be added to the builder.
func ( *MonthIntervalBuilder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

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

	return .Unmarshal()
}

// A type which represents an immutable sequence of arrow.DayTimeInterval values.
type DayTimeInterval struct {
	array
	values []arrow.DayTimeInterval
}

func ( arrow.ArrayData) *DayTimeInterval {
	 := &DayTimeInterval{}
	.refCount.Add(1)
	.setData(.(*Data))
	return 
}

func ( *DayTimeInterval) ( int) arrow.DayTimeInterval { return .values[] }
func ( *DayTimeInterval) ( int) string {
	if .IsNull() {
		return NullValueStr
	}
	,  := json.Marshal(.GetOneForMarshal())
	if  != nil {
		panic()
	}
	return string()
}

func ( *DayTimeInterval) () []arrow.DayTimeInterval { return .values }

func ( *DayTimeInterval) () string {
	 := new(strings.Builder)
	.WriteString("[")
	for ,  := range .values {
		if  > 0 {
			fmt.Fprintf(, " ")
		}
		switch {
		case .IsNull():
			.WriteString(NullValueStr)
		default:
			fmt.Fprintf(, "%v", )
		}
	}
	.WriteString("]")
	return .String()
}

func ( *DayTimeInterval) ( *Data) {
	.array.setData()
	 := .buffers[1]
	if  != nil {
		.values = arrow.DayTimeIntervalTraits.CastFromBytes(.Bytes())
		 := .data.offset
		 :=  + .data.length
		.values = .values[:]
	}
}

func ( *DayTimeInterval) ( int) interface{} {
	if .IsValid() {
		return .values[]
	}
	return nil
}

// MarshalJSON will marshal this array to JSON as an array of objects,
// consisting of the form {"days": #, "milliseconds": #} for each element.
func ( *DayTimeInterval) () ([]byte, error) {
	if .NullN() == 0 {
		return json.Marshal(.values)
	}
	 := make([]interface{}, .Len())
	for ,  := range .values {
		if .IsValid() {
			[] = 
		} else {
			[] = nil
		}
	}
	return json.Marshal()
}

func arrayEqualDayTimeInterval(,  *DayTimeInterval) bool {
	for  := 0;  < .Len(); ++ {
		if .IsNull() {
			continue
		}
		if .Value() != .Value() {
			return false
		}
	}
	return true
}

type DayTimeIntervalBuilder struct {
	builder

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

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

func ( *DayTimeIntervalBuilder) () arrow.DataType { return arrow.FixedWidthTypes.DayTimeInterval }

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *DayTimeIntervalBuilder) () {
	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 ( *DayTimeIntervalBuilder) ( arrow.DayTimeInterval) {
	.Reserve(1)
	.UnsafeAppend()
}

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

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

func ( *DayTimeIntervalBuilder) () {
	.Append(arrow.DayTimeInterval{})
}

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

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

func ( *DayTimeIntervalBuilder) ( 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 ( *DayTimeIntervalBuilder) ( []arrow.DayTimeInterval,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

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

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

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

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *DayTimeIntervalBuilder) ( int) {
	.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 ( *DayTimeIntervalBuilder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

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

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

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

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

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

	return
}

func ( *DayTimeIntervalBuilder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	var  arrow.DayTimeInterval
	if  := json.Unmarshal([]byte(), &);  != nil {
		.AppendNull()
		return 
	}
	.Append()
	return nil
}

func ( *DayTimeIntervalBuilder) ( *json.Decoder) error {
	var  *arrow.DayTimeInterval
	if  := .Decode(&);  != nil {
		return 
	}

	if  == nil {
		.AppendNull()
	} else {
		.Append(*)
	}
	return nil
}

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

// UnmarshalJSON will add the values unmarshalled from an array to the builder,
// with the values expected to be objects of the form {"days": #, "milliseconds": #}
func ( *DayTimeIntervalBuilder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

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

	return .Unmarshal()
}

// A type which represents an immutable sequence of arrow.DayTimeInterval values.
type MonthDayNanoInterval struct {
	array
	values []arrow.MonthDayNanoInterval
}

func ( arrow.ArrayData) *MonthDayNanoInterval {
	 := &MonthDayNanoInterval{}
	.refCount.Add(1)
	.setData(.(*Data))
	return 
}

func ( *MonthDayNanoInterval) ( int) arrow.MonthDayNanoInterval { return .values[] }
func ( *MonthDayNanoInterval) ( int) string {
	if .IsNull() {
		return NullValueStr
	}
	,  := json.Marshal(.GetOneForMarshal())
	if  != nil {
		panic()
	}
	return string()
}

func ( *MonthDayNanoInterval) () []arrow.MonthDayNanoInterval {
	return .values
}

func ( *MonthDayNanoInterval) () string {
	 := new(strings.Builder)
	.WriteString("[")
	for ,  := range .values {
		if  > 0 {
			fmt.Fprintf(, " ")
		}
		switch {
		case .IsNull():
			.WriteString(NullValueStr)
		default:
			fmt.Fprintf(, "%v", )
		}
	}
	.WriteString("]")
	return .String()
}

func ( *MonthDayNanoInterval) ( *Data) {
	.array.setData()
	 := .buffers[1]
	if  != nil {
		.values = arrow.MonthDayNanoIntervalTraits.CastFromBytes(.Bytes())
		 := .data.offset
		 :=  + .data.length
		.values = .values[:]
	}
}

func ( *MonthDayNanoInterval) ( int) interface{} {
	if .IsValid() {
		return .values[]
	}
	return nil
}

// MarshalJSON will marshal this array to a JSON array with elements
// marshalled to the form {"months": #, "days": #, "nanoseconds": #}
func ( *MonthDayNanoInterval) () ([]byte, error) {
	if .NullN() == 0 {
		return json.Marshal(.values)
	}
	 := make([]interface{}, .Len())
	for ,  := range .values {
		if .IsValid() {
			[] = 
		} else {
			[] = nil
		}
	}
	return json.Marshal()
}

func arrayEqualMonthDayNanoInterval(,  *MonthDayNanoInterval) bool {
	for  := 0;  < .Len(); ++ {
		if .IsNull() {
			continue
		}
		if .Value() != .Value() {
			return false
		}
	}
	return true
}

type MonthDayNanoIntervalBuilder struct {
	builder

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

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

func ( *MonthDayNanoIntervalBuilder) () arrow.DataType {
	return arrow.FixedWidthTypes.MonthDayNanoInterval
}

// Release decreases the reference count by 1.
// When the reference count goes to zero, the memory is freed.
func ( *MonthDayNanoIntervalBuilder) () {
	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 ( *MonthDayNanoIntervalBuilder) ( arrow.MonthDayNanoInterval) {
	.Reserve(1)
	.UnsafeAppend()
}

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

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

func ( *MonthDayNanoIntervalBuilder) () {
	.Append(arrow.MonthDayNanoInterval{})
}

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

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

func ( *MonthDayNanoIntervalBuilder) ( 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 ( *MonthDayNanoIntervalBuilder) ( []arrow.MonthDayNanoInterval,  []bool) {
	if len() != len() && len() != 0 {
		panic("len(v) != len(valid) && len(valid) != 0")
	}

	if len() == 0 {
		return
	}

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

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

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

// Reserve ensures there is enough space for appending n elements
// by checking the capacity and calling Resize if necessary.
func ( *MonthDayNanoIntervalBuilder) ( int) {
	.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 ( *MonthDayNanoIntervalBuilder) ( int) {
	 := 
	if  < minBuilderCapacity {
		 = minBuilderCapacity
	}

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

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

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

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

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

	return
}

func ( *MonthDayNanoIntervalBuilder) ( string) error {
	if  == NullValueStr {
		.AppendNull()
		return nil
	}
	var  arrow.MonthDayNanoInterval
	if  := json.Unmarshal([]byte(), &);  != nil {
		return 
	}
	.Append()
	return nil
}

func ( *MonthDayNanoIntervalBuilder) ( *json.Decoder) error {
	var  *arrow.MonthDayNanoInterval
	if  := .Decode(&);  != nil {
		return 
	}

	if  == nil {
		.AppendNull()
	} else {
		.Append(*)
	}
	return nil
}

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

// UnmarshalJSON unmarshals a JSON array of objects and adds them to this builder,
// each element of the array is expected to be an object of the form
// {"months": #, "days": #, "nanoseconds": #}
func ( *MonthDayNanoIntervalBuilder) ( []byte) error {
	 := json.NewDecoder(bytes.NewReader())
	,  := .Token()
	if  != nil {
		return 
	}

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

	return .Unmarshal()
}

var (
	_ arrow.Array = (*MonthInterval)(nil)
	_ arrow.Array = (*DayTimeInterval)(nil)
	_ arrow.Array = (*MonthDayNanoInterval)(nil)

	_ Builder = (*MonthIntervalBuilder)(nil)
	_ Builder = (*DayTimeIntervalBuilder)(nil)
	_ Builder = (*MonthDayNanoIntervalBuilder)(nil)

	_ arrow.TypedArray[arrow.MonthInterval]        = (*MonthInterval)(nil)
	_ arrow.TypedArray[arrow.DayTimeInterval]      = (*DayTimeInterval)(nil)
	_ arrow.TypedArray[arrow.MonthDayNanoInterval] = (*MonthDayNanoInterval)(nil)
)