public abstract class Projection extends Object
Projection represents a list of (possibly nested) indexes that can be used to project
data types. A row projection includes both reducing the accessible fields and reordering them.| Modifier and Type | Method and Description |
|---|---|
abstract Projection |
complement(int fieldsNumber)
Complement this projection.
|
abstract Projection |
difference(Projection other)
Perform a difference of this
Projection with another Projection. |
static Projection |
empty()
Create an empty
Projection, that is a projection that projects no fields, returning
an empty DataType. |
boolean |
equals(Object o) |
int |
hashCode() |
abstract boolean |
isNested() |
static Projection |
of(int[] indexes)
Create a
Projection of the provided indexes. |
static Projection |
of(int[][] indexes)
Create a
Projection of the provided indexes. |
<T> List<T> |
project(List<T> list)
Project list.
|
abstract RowType |
project(RowType rowType) |
<T> T[] |
project(T[] array)
Project array.
|
static Projection |
range(int startInclusive,
int endExclusive)
Create a
Projection of a field range. |
abstract int[][] |
toNestedIndexes()
Convert this instance to a nested projection index paths.
|
String |
toString() |
abstract int[] |
toTopLevelIndexes()
Convert this instance to a projection of top level indexes.
|
public <T> T[] project(T[] array)
public abstract boolean isNested()
true whether this projection is nested or not.public abstract Projection difference(Projection other)
Projection with another Projection. The result
of this operation is a new Projection retaining the same ordering of this instance
but with the indexes from other removed. For example:
[4, 1, 0, 3, 2] - [4, 2] = [1, 0, 2]
Note how the index 3 in the minuend becomes 2 because it's rescaled to
project correctly a InternalRow or arity 3.
other - the subtrahendIllegalArgumentException - when other is nested.public abstract Projection complement(int fieldsNumber)
fieldsNumber except the indexes in this Projection. For example:
[4, 2].complement(5) = [0, 1, 3]
fieldsNumber - the size of the universeIllegalStateException - if this projection is nested.public abstract int[] toTopLevelIndexes()
DataType. For example, [0, 2, 1] specifies to
include in the following order the 1st field, the 3rd field and the 2nd field of the row.IllegalStateException - if this projection is nested.public abstract int[][] toNestedIndexes()
DataType, including nested rows. For example, [[0,
2, 1], ...] specifies to include the 2nd field of the 3rd field of the 1st field in the
top-level row.public static Projection empty()
Projection, that is a projection that projects no fields, returning
an empty DataType.public static Projection of(int[] indexes)
Projection of the provided indexes.toTopLevelIndexes()public static Projection of(int[][] indexes)
Projection of the provided indexes.toNestedIndexes()public static Projection range(int startInclusive, int endExclusive)
Projection of a field range.Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.