Table of Contents

Class RunEndEncodedArray

Namespace
Apache.Arrow
Assembly
Apache.Arrow.dll

Represents a run-end encoded array. A run-end encoded array stores consecutive runs of the same value more efficiently. It contains two child arrays: run_ends (Int16/Int32/Int64) and values (any type). The run_ends array stores the cumulative end positions of each run.

public class RunEndEncodedArray : Array, IArrowArray, IDisposable
Inheritance
RunEndEncodedArray
Implements
Inherited Members
Extension Methods

Constructors

RunEndEncodedArray(ArrayData)

Creates a new RunEndEncodedArray from ArrayData.

public RunEndEncodedArray(ArrayData data)

Parameters

data ArrayData

The array data containing run ends and values as children.

RunEndEncodedArray(IArrowArray, IArrowArray)

Creates a new RunEndEncodedArray with specified run ends and values arrays.

public RunEndEncodedArray(IArrowArray runEnds, IArrowArray values)

Parameters

runEnds IArrowArray

The run ends array (must be Int16Array, Int32Array, or Int64Array).

values IArrowArray

The values array (can be any type).

Properties

RunEnds

Gets the run ends array (Int16Array, Int32Array, or Int64Array). This array contains the cumulative end indices for each run.

public IArrowArray RunEnds { get; }

Property Value

IArrowArray

Values

Gets the values array. This array contains the actual values that are run-length encoded.

public IArrowArray Values { get; }

Property Value

IArrowArray

Methods

Accept(IArrowArrayVisitor)

public override void Accept(IArrowArrayVisitor visitor)

Parameters

visitor IArrowArrayVisitor

EnumeratePhysicalIndices()

Enumerates the physical index for every logical position in order. Unlike repeated calls to FindPhysicalIndex(int), this walks the run-ends array linearly, yielding O(n + m) total work instead of O(n·log m).

public IEnumerable<int> EnumeratePhysicalIndices()

Returns

IEnumerable<int>

FindPhysicalIndex(int)

Finds the physical index in the run_ends array that contains the specified logical index.

public int FindPhysicalIndex(int logicalIndex)

Parameters

logicalIndex int

The logical index in the decoded array.

Returns

int

The physical index in the run_ends/values arrays.

Normalize()

Returns a logically equivalent RunEndEncodedArray whose underlying children have been normalized to the slice range:

  • Offset is 0,
  • the run-ends array contains only the runs covering this slice, with values shifted so that the last run-end equals the slice Length,
  • the values array is sliced to the corresponding physical range.

The returned array is independently disposable: it owns its own references to the underlying buffers via reference counting, so it remains valid even if this instance is later disposed. Callers are responsible for disposing the returned array when done with it. The result may or may not be the same instance as this; either way, it carries an independent reference.

public RunEndEncodedArray Normalize()

Returns

RunEndEncodedArray