extensions

package
v18.0.0-rc0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2024 License: Apache-2.0, BSD-3-Clause Imports: 14 Imported by: 2

Documentation

Overview

Package extensions provides implementations of Arrow canonical extension types as defined in the Arrow specification. https://arrow.apache.org/docs/format/CanonicalExtensions.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bool8Array

type Bool8Array struct {
	array.ExtensionArrayBase
}

Bool8Array is logically an array of boolean values but uses 8 bits to store values instead of 1 bit as in the native BooleanArray.

func (*Bool8Array) BoolValues

func (a *Bool8Array) BoolValues() []bool

func (*Bool8Array) GetOneForMarshal

func (a *Bool8Array) GetOneForMarshal(i int) interface{}

func (*Bool8Array) MarshalJSON

func (a *Bool8Array) MarshalJSON() ([]byte, error)

func (*Bool8Array) String

func (a *Bool8Array) String() string

func (*Bool8Array) Value

func (a *Bool8Array) Value(i int) bool

func (*Bool8Array) ValueStr

func (a *Bool8Array) ValueStr(i int) string

type Bool8Builder

type Bool8Builder struct {
	*array.ExtensionBuilder
}

Bool8Builder is a convenience builder for the Bool8 extension type, allowing arrays to be built with boolean values rather than the underlying storage type.

func NewBool8Builder

func NewBool8Builder(mem memory.Allocator) *Bool8Builder

NewBool8Builder creates a new Bool8Builder, exposing a convenient and efficient interface for writing boolean values to the underlying int8 storage array.

func (*Bool8Builder) Append

func (b *Bool8Builder) Append(v bool)

func (*Bool8Builder) AppendValueFromString

func (b *Bool8Builder) AppendValueFromString(s string) error

func (*Bool8Builder) AppendValues

func (b *Bool8Builder) AppendValues(v []bool, valid []bool)

func (*Bool8Builder) Unmarshal

func (b *Bool8Builder) Unmarshal(dec *json.Decoder) error

func (*Bool8Builder) UnmarshalOne

func (b *Bool8Builder) UnmarshalOne(dec *json.Decoder) error

func (*Bool8Builder) UnsafeAppend

func (b *Bool8Builder) UnsafeAppend(v bool)

type Bool8Type

type Bool8Type struct {
	arrow.ExtensionBase
}

Bool8Type represents a logical boolean that is stored using 8 bits.

func NewBool8Type

func NewBool8Type() *Bool8Type

NewBool8Type creates a new Bool8Type with the underlying storage type set correctly to Int8.

func (*Bool8Type) ArrayType

func (b *Bool8Type) ArrayType() reflect.Type

func (*Bool8Type) Deserialize

func (b *Bool8Type) Deserialize(storageType arrow.DataType, data string) (arrow.ExtensionType, error)

func (*Bool8Type) ExtensionEquals

func (b *Bool8Type) ExtensionEquals(other arrow.ExtensionType) bool

func (*Bool8Type) ExtensionName

func (b *Bool8Type) ExtensionName() string

func (*Bool8Type) NewBuilder

func (*Bool8Type) NewBuilder(mem memory.Allocator) array.Builder

func (*Bool8Type) Serialize

func (b *Bool8Type) Serialize() string

func (*Bool8Type) String

func (b *Bool8Type) String() string

type JSONArray

type JSONArray struct {
	array.ExtensionArrayBase
}

JSONArray is logically an array of UTF-8 encoded JSON strings. Its values are unmarshaled to native Go values.

func (*JSONArray) GetOneForMarshal

func (a *JSONArray) GetOneForMarshal(i int) interface{}

GetOneForMarshal implements arrow.Array.

func (*JSONArray) MarshalJSON

func (a *JSONArray) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler. Marshaling json.RawMessage is a no-op, except that nil values will be marshaled as a JSON null.

func (*JSONArray) String

func (a *JSONArray) String() string

func (*JSONArray) Value

func (a *JSONArray) Value(i int) any

func (*JSONArray) ValueBytes

func (a *JSONArray) ValueBytes(i int) []byte

func (*JSONArray) ValueJSON

func (a *JSONArray) ValueJSON(i int) json.RawMessage

ValueJSON wraps the underlying string value as a json.RawMessage, or returns nil if the array value is null.

func (*JSONArray) ValueStr

func (a *JSONArray) ValueStr(i int) string

type JSONType

type JSONType struct {
	arrow.ExtensionBase
}

JSONType represents a UTF-8 encoded JSON string as specified in RFC8259.

func NewJSONType

func NewJSONType(storageType arrow.DataType) (*JSONType, error)

NewJSONType creates a new JSONType with the specified storage type. storageType must be one of String, LargeString, StringView.

func (*JSONType) ArrayType

func (b *JSONType) ArrayType() reflect.Type

func (*JSONType) Deserialize

func (b *JSONType) Deserialize(storageType arrow.DataType, data string) (arrow.ExtensionType, error)

func (*JSONType) ExtensionEquals

func (b *JSONType) ExtensionEquals(other arrow.ExtensionType) bool

func (*JSONType) ExtensionName

func (b *JSONType) ExtensionName() string

func (*JSONType) ParquetLogicalType

func (b *JSONType) ParquetLogicalType() schema.LogicalType

ParquetLogicalType implements pqarrow.ExtensionCustomParquetType.

func (*JSONType) Serialize

func (b *JSONType) Serialize() string

func (*JSONType) String

func (b *JSONType) String() string

type OpaqueArray

type OpaqueArray struct {
	array.ExtensionArrayBase
}

OpaqueArray is a placeholder for data from an external (usually non-Arrow) system that could not be interpreted.

type OpaqueType

type OpaqueType struct {
	arrow.ExtensionBase `json:"-"`

	TypeName   string `json:"type_name"`
	VendorName string `json:"vendor_name"`
}

OpaqueType is a placeholder for a type from an external (usually non-Arrow) system that could not be interpreted.

func NewOpaqueType

func NewOpaqueType(storageType arrow.DataType, name, vendorName string) *OpaqueType

NewOpaqueType creates a new OpaqueType with the provided storage type, type name, and vendor name.

func (*OpaqueType) ArrayType

func (*OpaqueType) ArrayType() reflect.Type

func (*OpaqueType) Deserialize

func (*OpaqueType) Deserialize(storageType arrow.DataType, data string) (arrow.ExtensionType, error)

func (*OpaqueType) ExtensionEquals

func (o *OpaqueType) ExtensionEquals(other arrow.ExtensionType) bool

func (*OpaqueType) ExtensionName

func (*OpaqueType) ExtensionName() string

func (*OpaqueType) Serialize

func (o *OpaqueType) Serialize() string

func (*OpaqueType) String

func (o *OpaqueType) String() string

type UUIDArray

type UUIDArray struct {
	array.ExtensionArrayBase
}

UUIDArray is a simple array which is a FixedSizeBinary(16)

func (*UUIDArray) GetOneForMarshal

func (a *UUIDArray) GetOneForMarshal(i int) interface{}

func (*UUIDArray) MarshalJSON

func (a *UUIDArray) MarshalJSON() ([]byte, error)

func (*UUIDArray) String

func (a *UUIDArray) String() string

func (*UUIDArray) Value

func (a *UUIDArray) Value(i int) uuid.UUID

func (*UUIDArray) ValueStr

func (a *UUIDArray) ValueStr(i int) string

func (*UUIDArray) Values

func (a *UUIDArray) Values() []uuid.UUID

type UUIDBuilder

type UUIDBuilder struct {
	*array.ExtensionBuilder
}

func NewUUIDBuilder

func NewUUIDBuilder(mem memory.Allocator) *UUIDBuilder

NewUUIDBuilder creates a new UUIDBuilder, exposing a convenient and efficient interface for writing uuid.UUID (or [16]byte) values to the underlying FixedSizeBinary storage array.

func (*UUIDBuilder) Append

func (b *UUIDBuilder) Append(v uuid.UUID)

func (*UUIDBuilder) AppendBytes

func (b *UUIDBuilder) AppendBytes(v [16]byte)

func (*UUIDBuilder) AppendValueFromString

func (b *UUIDBuilder) AppendValueFromString(s string) error

func (*UUIDBuilder) AppendValues

func (b *UUIDBuilder) AppendValues(v []uuid.UUID, valid []bool)

func (*UUIDBuilder) Unmarshal

func (b *UUIDBuilder) Unmarshal(dec *json.Decoder) error

func (*UUIDBuilder) UnmarshalJSON

func (b *UUIDBuilder) UnmarshalJSON(data []byte) error

func (*UUIDBuilder) UnmarshalOne

func (b *UUIDBuilder) UnmarshalOne(dec *json.Decoder) error

func (*UUIDBuilder) UnsafeAppend

func (b *UUIDBuilder) UnsafeAppend(v uuid.UUID)

type UUIDType

type UUIDType struct {
	arrow.ExtensionBase
}

UUIDType is a simple extension type that represents a FixedSizeBinary(16) to be used for representing UUIDs

func NewUUIDType

func NewUUIDType() *UUIDType

NewUUIDType is a convenience function to create an instance of UUIDType with the correct storage type

func (*UUIDType) ArrayType

func (*UUIDType) ArrayType() reflect.Type

ArrayType returns TypeOf(UUIDArray{}) for constructing UUID arrays

func (*UUIDType) Deserialize

func (*UUIDType) Deserialize(storageType arrow.DataType, data string) (arrow.ExtensionType, error)

Deserialize expects storageType to be FixedSizeBinaryType{ByteWidth: 16}

func (*UUIDType) ExtensionEquals

func (e *UUIDType) ExtensionEquals(other arrow.ExtensionType) bool

ExtensionEquals returns true if both extensions have the same name

func (*UUIDType) ExtensionName

func (*UUIDType) ExtensionName() string

func (*UUIDType) MarshalJSON

func (e *UUIDType) MarshalJSON() ([]byte, error)

func (*UUIDType) NewBuilder

func (*UUIDType) NewBuilder(mem memory.Allocator) array.Builder

func (*UUIDType) ParquetLogicalType

func (e *UUIDType) ParquetLogicalType() schema.LogicalType

ParquetLogicalType implements pqarrow.ExtensionCustomParquetType.

func (*UUIDType) Serialize

func (*UUIDType) Serialize() string

func (*UUIDType) String

func (e *UUIDType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL