encoded

package
v18.0.0 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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindPhysicalIndex

func FindPhysicalIndex(arr arrow.ArrayData, logicalIdx int) int

FindPhysicalIndex performs a binary search on the run-ends to return the appropriate physical offset into the values/run-ends that corresponds with the logical index provided when called. If the array's logical offset is provided, this is equivalent to calling FindPhysicalOffset.

For example, an array with run-ends [10, 20, 30, 40, 50] and a logicalIdx of 25 will return the value 2. This returns the smallest offset whose run-end is greater than the logicalIdx requested, which would also be the index into the values that contains the correct value.

This function assumes it receives Run End Encoded array data

func FindPhysicalOffset

func FindPhysicalOffset(arr arrow.ArrayData) int

FindPhysicalOffset performs a binary search on the run-ends to return the appropriate physical offset into the values/run-ends that corresponds with the logical offset defined in the array.

For example, an array with run-ends [10, 20, 30, 40, 50] and a logical offset of 25 will return the value 2. This returns the smallest offset whose run-end is greater than the logical offset, which would also be the offset index into the values that contains the correct value.

This function assumes it receives Run End Encoded array data

func GetPhysicalLength

func GetPhysicalLength(arr arrow.ArrayData) int

GetPhysicalLength returns the physical number of values which are in the passed in RunEndEncoded array data. This will take into account the offset and length of the array as reported in the array data (so that it properly handles slices).

This function assumes it receives Run End Encoded array data

Types

type MergedRuns

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

MergedRuns is used to take two Run End Encoded arrays and iterate them, finding the correct physical indices to correspond with the runs.

func NewMergedRuns

func NewMergedRuns(inputs [2]arrow.Array) *MergedRuns

NewMergedRuns takes two RunEndEncoded arrays and returns a MergedRuns object that will allow iterating over the physical indices of the runs.

func (*MergedRuns) AccumulatedRunLength

func (mr *MergedRuns) AccumulatedRunLength() int64

AccumulatedRunLength returns the logical run end of the current merged run.

func (*MergedRuns) IndexIntoArray

func (mr *MergedRuns) IndexIntoArray(id int) int64

IndexIntoArray is like IndexIntoBuffer but it doesn't take into account the array offset and instead is the index that can be used with the .Value method on the array to get the correct value.

func (*MergedRuns) IndexIntoBuffer

func (mr *MergedRuns) IndexIntoBuffer(id int) int64

IndexIntoBuffer returns the physical index into the value buffer of the passed in array index (ie: 0 for the first array and 1 for the second) this takes into account the offset of the array so it is the true physical index into the value *buffer* in the child.

func (*MergedRuns) Next

func (mr *MergedRuns) Next() bool

Next returns true if there are more values/runs to iterate and false when one of the arrays has reached the end.

func (*MergedRuns) RunLength

func (mr *MergedRuns) RunLength() int64

RunLength returns the logical length of the current merged run being looked at.

Jump to

Keyboard shortcuts

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