arrowconv

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package arrowconv provides helper utilities for converting between Arrow and dataset values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatasetType

func DatasetType(arrowType arrow.DataType) (datasetmd.PhysicalType, bool)

DatasetType returns the datasetmd.ValueType that corresponds to the given Arrow type.

- arrow.INT64 maps to datasetmd.PHYSICAL_TYPE_INT64. - arrow.UINT64 maps to datasetmd.PHYSICAL_TYPE_UINT64. - arrow.TIMESTAMP maps to datasetmd.PHYSICAL_TYPE_INT64. - arrow.STRING maps to datasetmd.PHYSICAL_TYPE_BINARY. - arrow.BINARY maps to datasetmd.PHYSICAL_TYPE_BINARY.

DatasetType returns datasetmd.PHYSICAL_TYPE_UNSPECIFIED, false for unsupported Arrow types.

func FromScalar

func FromScalar(s scalar.Scalar, toType datasetmd.PhysicalType) dataset.Value

FromScalar converts a scalar.Scalar into a dataset.Value of the specified type.

The kind of toType and the type of s must be compatible:

- For datasetmd.PHYSICAL_TYPE_INT64, s must be a scalar.Int64 or scalar.Timestamp. - For datasetmd.PHYSICAL_TYPE_UINT64, s must be a scalar.Uint64. - For datasetmd.PHYSICAL_TYPE_BINARY, s must be a scalar.Binary or scalar.String.

If s references allocated memory, FromScalar will hold a reference to that memory. Callers are responsible for releasing the scalar after the returned dataset.Value is no longer used.

If s is a null type, it will return a nil dataset.Value.

func ToScalar

func ToScalar(v dataset.Value, toType arrow.DataType) scalar.Scalar

ToScalar converts a dataset.Value into a scalar.Scalar of the specified type.

The kind of toType and the type of v and toType must be compatible:

If v is nil, ToScalar returns a null scalar of the specified type. If toType is a Null type, then ToScalar returns a null scalar even if v is non-null.

ToScalar panics if v and toType are not compatible.

Types

This section is empty.

Jump to

Keyboard shortcuts

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