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 ¶
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 ¶
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:
- For arrow.INT64, v must be a datasetmd.PHYSICAL_TYPE_INT64.
- For arrow.UINT64, v must be a datasetmd.PHYSICAL_TYPE_UINT64.
- For arrow.TIMESTAMP, v must be a datasetmd.PHYSICAL_TYPE_INT64, which will be converted into a nanosecond timestamp.
- For arrow.STRING, v must be a datasetmd.PHYSICAL_TYPE_BINARY.
- For arrow.BINARY, v must be a datasetmd.PHYSICAL_TYPE_BINARY.
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.