schema

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToArrow

func ToArrow(s *Schema) (*arrow.Schema, error)

ToArrow builds an Arrow schema from a Cosma Schema. Every field must carry a non-nil ArrowType (set by FromArrow or at construction).

Types

type DType

type DType string

DType is Cosma’s logical type enum. Keep it small at first; you can map it to Arrow types later.

const (
	Null            DType = "null"
	Bool            DType = "bool"
	Int8            DType = "int8"
	Int16           DType = "int16"
	Int32           DType = "int32"
	Int64           DType = "int64"
	UInt8           DType = "uint8"
	UInt16          DType = "uint16"
	UInt32          DType = "uint32"
	UInt64          DType = "uint64"
	Float16         DType = "float16"
	Float32         DType = "float32"
	Float64         DType = "float64"
	Utf8            DType = "utf8"
	String          DType = Utf8
	LargeUtf8       DType = "large_utf8"
	Binary          DType = "binary"
	LargeBinary     DType = "large_binary"
	FixedSizeBinary DType = "fixed_size_binary"
	Date32          DType = "date32"
	Date64          DType = "date64"
	Time32          DType = "time32"
	Time64          DType = "time64"
	Timestamp       DType = "timestamp"
	Duration        DType = "duration"
	IntervalMonth   DType = "interval_month"
	IntervalDayTime DType = "interval_day_time"
	IntervalMDN     DType = "interval_month_day_nano"
	List            DType = "list"
	LargeList       DType = "large_list"
	FixedSizeList   DType = "fixed_size_list"
	ListView        DType = "list_view"
	LargeListView   DType = "large_list_view"
	Struct          DType = "struct"
	Map             DType = "map"
	SparseUnion     DType = "sparse_union"
	DenseUnion      DType = "dense_union"
	Dictionary      DType = "dictionary"
	Decimal128      DType = "decimal128"
	Decimal256      DType = "decimal256"
	RunEndEncoded   DType = "run_end_encoded"
	Extension       DType = "extension"
	StringView      DType = "string_view"
	BinaryView      DType = "binary_view"
)

func DTypeFromArrow

func DTypeFromArrow(dt arrow.DataType) (DType, error)

DTypeFromArrow maps an Arrow data type to its Cosma logical DType.

type Field

type Field struct {
	Name      string
	Type      DType
	Nullable  bool
	ArrowType arrow.DataType
}

func FieldFromArrow

func FieldFromArrow(name string, dt arrow.DataType) (Field, error)

FieldFromArrow builds a single non-nullable Field from a name and Arrow type.

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema is a minimal public schema with controlled mutability.

func FromArrow

func FromArrow(s *arrow.Schema) (*Schema, error)

FromArrow builds a Cosma Schema from an Arrow schema, carrying each field's Arrow type through so it can be translated back losslessly.

func New

func New(fields ...Field) *Schema

func (*Schema) Field

func (s *Schema) Field(name string) (Field, bool)

func (*Schema) FieldIndex

func (s *Schema) FieldIndex(name string) (int, bool)

func (*Schema) Fields

func (s *Schema) Fields() []Field

func (*Schema) Len

func (s *Schema) Len() int

func (*Schema) String

func (s *Schema) String() string

Jump to

Keyboard shortcuts

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