package arrowutils

Import Path
	github.com/polarsignals/frostdb/pqarrow/arrowutils (on go.dev)

Dependency Relation
	imports 18 packages, and imported by 2 packages


Package-Level Type Names (total 5)
/* sort by: | */
ArrayConcatenator is an object that helps callers keep track of a slice of arrays and concatenate them into a single one when needed. This is more efficient and memory safe than using a builder. (*ArrayConcatenator) Add(arr arrow.Array) (*ArrayConcatenator) Len() int (*ArrayConcatenator) NewArray(mem memory.Allocator) (arrow.Array, error) (*ArrayConcatenator) Release()
const Ascending const Descending
( Int64Heap) Len() int ( Int64Heap) Less(i, j int) bool (*Int64Heap) Pop() any PopNextNotEqual returns the next least element not equal to compare. (*Int64Heap) Push(x any) ( Int64Heap) Swap(i, j int) Unwrap unwraps the heap into the provided scratch space. The result is a slice that will have distinct ints in order. This helps with reiterating over the same heap. *Int64Heap : container/heap.Interface Int64Heap : sort.Interface func GetGroupsAndOrderedSetRanges(firstGroup []any, arrs []arrow.Array) (*Int64Heap, *Int64Heap, []any, error) func GetGroupsAndOrderedSetRanges(firstGroup []any, arrs []arrow.Array) (*Int64Heap, *Int64Heap, []any, error)
SortingColumn describes a sorting column on a arrow.Record. Direction Direction Index int NullsFirst bool func MergeRecords(mem memory.Allocator, records []arrow.Record, orderByCols []SortingColumn, limit uint64) (arrow.Record, error) func SortRecord(r arrow.Record, columns []SortingColumn) (*array.Int32, error)
VirtualNullArray is an arrow.Array that will return that any element is null via the arrow.Array interface methods. This is useful if callers need to represent an array of len NULL values without allocating/storing a bitmap. This should only be used internally. If callers need a physical null array, call MakeNullArray. ( VirtualNullArray) Data() arrow.ArrayData ( VirtualNullArray) DataType() arrow.DataType ( VirtualNullArray) GetOneForMarshal(_ int) any ( VirtualNullArray) IsNull(_ int) bool ( VirtualNullArray) IsValid(_ int) bool ( VirtualNullArray) Len() int ( VirtualNullArray) MarshalJSON() ([]byte, error) ( VirtualNullArray) NullBitmapBytes() []byte ( VirtualNullArray) NullN() int ( VirtualNullArray) Release() ( VirtualNullArray) Retain() ( VirtualNullArray) String() string ( VirtualNullArray) ValueStr(_ int) string VirtualNullArray : github.com/apache/arrow-go/v18/arrow.Array[T] VirtualNullArray : github.com/apache/arrow-go/v18/arrow/scalar.Releasable VirtualNullArray : github.com/goccy/go-json.Marshaler VirtualNullArray : encoding/json.Marshaler VirtualNullArray : expvar.Var VirtualNullArray : fmt.Stringer func MakeVirtualNullArray(dt arrow.DataType, length int) VirtualNullArray
Package-Level Functions (total 12)
EnsureSameSchema ensures that all the records have the same schema. In cases where the schema is not equal, virtual null columns are inserted in the records with the missing column. When we have static schemas in the execution engine, steps like these should be unnecessary.
GetGroupsAndOrderedSetRanges returns a min-heap of group ranges and ordered set ranges of the given arrow arrays in that order. For the given input with a single array: a a c d a b c This function will return [2, 3, 4, 5, 6] for the group ranges and [4] for the ordered set ranges. A group is a collection of values that are equal and an ordered set is a collection of groups that are in increasing order. The ranges are determined by iterating over the arrays and comparing the current group value for each column. The firstGroup to compare against must be provided (it can be initialized to the values at index 0 of each array). The last group found is returned.
MakeNullArray makes a physical arrow.Array full of NULLs of the given DataType.
MergeRecords merges the given records. The records must all have the same schema. orderByCols is a slice of indexes into the columns that the records and resulting records are ordered by. While ordering the limit is checked before appending more rows. If limit is 0, no limit is applied. Note that the given records should already be ordered by the given columns. WARNING: Only ascending ordering is currently supported.
SortRecord sorts given arrow.Record by columns. Returns *array.Int32 of indices to sorted rows or record r. Comparison is made sequentially by each column. When rows are equal in the first column we compare the rows om the second column and so on and so forth until rows that are not equal are found.
Take uses indices which is an array of row index and returns a new record that only contains rows specified in indices. Use compute.WithAllocator to pass a custom memory.Allocator.
func TakeColumn(ctx context.Context, a arrow.Array, idx int, arr []arrow.Array, indices *array.Int32) error
func TakeListColumn(ctx context.Context, a *array.List, idx int, arr []arrow.Array, indices *array.Int32) error
func TakeStructColumn(ctx context.Context, a *array.Struct, idx int, arr []arrow.Array, indices *array.Int32) error
Package-Level Constants (total 2)
const Ascending Direction = 0