| Modifier and Type | Method and Description |
|---|---|
List<org.apache.calcite.linq4j.tree.Expression> |
accessors(org.apache.calcite.linq4j.tree.Expression v1,
List<Integer> argList) |
@Nullable org.apache.calcite.linq4j.tree.Expression |
comparer()
Returns a expression that yields a comparer, or null if this type
is comparable.
|
PhysType |
component(int fieldOrdinal)
Returns the physical type of a given field's component type.
|
org.apache.calcite.linq4j.tree.Expression |
convertTo(org.apache.calcite.linq4j.tree.Expression exp,
JavaRowFormat targetFormat)
Converts an enumerable of this physical type to an enumerable that uses
the
targetFormat for representing its rows. |
org.apache.calcite.linq4j.tree.Expression |
convertTo(org.apache.calcite.linq4j.tree.Expression exp,
PhysType targetPhysType)
Converts an enumerable of this physical type to an enumerable that uses a
given physical type for its rows.
|
PhysType |
field(int ordinal)
Returns the physical type of a field.
|
Class |
fieldClass(int field)
Returns the Java class of the field with the given ordinal.
|
boolean |
fieldNullable(int field)
Returns whether a given field allows null values.
|
org.apache.calcite.linq4j.tree.Expression |
fieldReference(org.apache.calcite.linq4j.tree.Expression expression,
int field)
Generates a reference to a given field in an expression.
|
org.apache.calcite.linq4j.tree.Expression |
fieldReference(org.apache.calcite.linq4j.tree.Expression expression,
int field,
@Nullable Type storageType)
Generates a reference to a given field in an expression.
|
org.apache.calcite.linq4j.tree.Expression |
generateAccessor(List<Integer> fields)
Generates an accessor function for a given list of fields.
|
Pair<org.apache.calcite.linq4j.tree.Expression,org.apache.calcite.linq4j.tree.Expression> |
generateCollationKey(List<RelFieldCollation> collations)
Returns a lambda to create a collation key and a comparator.
|
org.apache.calcite.linq4j.tree.Expression |
generateComparator(RelCollation collation)
Returns a comparator.
|
org.apache.calcite.linq4j.tree.Expression |
generateSelector(org.apache.calcite.linq4j.tree.ParameterExpression parameter,
List<Integer> fields)
Generates a selector for the given fields from an expression, with the
default row format.
|
org.apache.calcite.linq4j.tree.Expression |
generateSelector(org.apache.calcite.linq4j.tree.ParameterExpression parameter,
List<Integer> fields,
JavaRowFormat targetFormat)
Generates a lambda expression that is a selector for the given fields from
an expression.
|
org.apache.calcite.linq4j.tree.Expression |
generateSelector(org.apache.calcite.linq4j.tree.ParameterExpression parameter,
List<Integer> fields,
List<Integer> usedFields,
JavaRowFormat targetFormat)
Generates a lambda expression that is a selector for the given fields from
an expression.
|
JavaRowFormat |
getFormat()
Returns the format.
|
Type |
getJavaFieldType(int index)
Returns the Java class that is used to store the field with the given
ordinal.
|
Type |
getJavaRowType()
Returns the Java type (often a Class) that represents a row.
|
RelDataType |
getRowType()
Returns the SQL row type.
|
PhysType |
makeNullable(boolean nullable)
Returns a copy of this type that allows nulls if
nullable is
true. |
static PhysType |
of(JavaTypeFactory typeFactory,
RelDataType rowType,
JavaRowFormat format) |
static PhysType |
of(JavaTypeFactory typeFactory,
RelDataType rowType,
JavaRowFormat format,
boolean optimize) |
PhysType |
project(List<Integer> integers,
boolean indicator,
JavaRowFormat format)
Projects a given collection of fields from this input record, optionally
with indicator fields, into a particular preferred output format.
|
PhysType |
project(List<Integer> integers,
JavaRowFormat format)
Projects a given collection of fields from this input record, into
a particular preferred output format.
|
org.apache.calcite.linq4j.tree.Expression |
record(List<org.apache.calcite.linq4j.tree.Expression> expressions)
Generates an expression that creates a record for a row, initializing
its fields with the given expressions.
|
Pair<Type,List<org.apache.calcite.linq4j.tree.Expression>> |
selector(org.apache.calcite.linq4j.tree.ParameterExpression parameter,
List<Integer> fields,
JavaRowFormat targetFormat)
Generates a selector for the given fields from an expression.
|
public static PhysType of(JavaTypeFactory typeFactory, RelDataType rowType, JavaRowFormat format)
public static PhysType of(JavaTypeFactory typeFactory, RelDataType rowType, JavaRowFormat format, boolean optimize)
public JavaRowFormat getFormat()
PhysTypepublic PhysType project(List<Integer> integers, JavaRowFormat format)
PhysTypepublic PhysType project(List<Integer> integers, boolean indicator, JavaRowFormat format)
PhysTypeThe output format is optimized if there are 0 or 1 fields and indicators are disabled.
public org.apache.calcite.linq4j.tree.Expression generateSelector(org.apache.calcite.linq4j.tree.ParameterExpression parameter,
List<Integer> fields)
PhysTypegenerateSelector in interface PhysTypepublic org.apache.calcite.linq4j.tree.Expression generateSelector(org.apache.calcite.linq4j.tree.ParameterExpression parameter,
List<Integer> fields,
JavaRowFormat targetFormat)
PhysTypegenerateSelector in interface PhysTypepublic org.apache.calcite.linq4j.tree.Expression generateSelector(org.apache.calcite.linq4j.tree.ParameterExpression parameter,
List<Integer> fields,
List<Integer> usedFields,
JavaRowFormat targetFormat)
PhysTypeusedFields must be a subset of fields.
For each field, there is a corresponding indicator field.
If a field is used, its value is assigned and its indicator is left
false.
If a field is not used, its value is not assigned and its indicator is
set to true;
This will become a value of 1 when GROUPING(field) is called.
generateSelector in interface PhysTypepublic Pair<Type,List<org.apache.calcite.linq4j.tree.Expression>> selector(org.apache.calcite.linq4j.tree.ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat)
PhysTypepublic List<org.apache.calcite.linq4j.tree.Expression> accessors(org.apache.calcite.linq4j.tree.Expression v1, List<Integer> argList)
public PhysType makeNullable(boolean nullable)
PhysTypenullable is
true.makeNullable in interface PhysTypepublic org.apache.calcite.linq4j.tree.Expression convertTo(org.apache.calcite.linq4j.tree.Expression exp,
PhysType targetPhysType)
PhysTypepublic org.apache.calcite.linq4j.tree.Expression convertTo(org.apache.calcite.linq4j.tree.Expression exp,
JavaRowFormat targetFormat)
PhysTypetargetFormat for representing its rows.public Pair<org.apache.calcite.linq4j.tree.Expression,org.apache.calcite.linq4j.tree.Expression> generateCollationKey(List<RelFieldCollation> collations)
PhysTypegenerateCollationKey in interface PhysTypepublic org.apache.calcite.linq4j.tree.Expression generateComparator(RelCollation collation)
PhysTypePhysType.generateCollationKey(java.util.List), this comparator acts on the
whole element.generateComparator in interface PhysTypepublic RelDataType getRowType()
PhysTypegetRowType in interface PhysTypepublic org.apache.calcite.linq4j.tree.Expression record(List<org.apache.calcite.linq4j.tree.Expression> expressions)
PhysTypepublic Type getJavaRowType()
PhysTypeObject[].class.getJavaRowType in interface PhysTypepublic Type getJavaFieldType(int index)
PhysTypeFor instance, when the java row type is Object[], the java
field type is Object even if the field is not nullable.
getJavaFieldType in interface PhysTypepublic PhysType component(int fieldOrdinal)
PhysTypepublic PhysType field(int ordinal)
PhysTypepublic @Nullable org.apache.calcite.linq4j.tree.Expression comparer()
PhysTypepublic Class fieldClass(int field)
PhysTypefieldClass in interface PhysTypepublic boolean fieldNullable(int field)
PhysTypefieldNullable in interface PhysTypepublic org.apache.calcite.linq4j.tree.Expression generateAccessor(List<Integer> fields)
PhysTypeList (implementing Object.hashCode() and
Object.equals(Object) per that interface) and also implements
Comparable.
For example:
new Function1<Employee, Object[]> {
public Object[] apply(Employee v1) {
return FlatLists.of(v1.<fieldN>, v1.<fieldM>);
}
}
}generateAccessor in interface PhysTypepublic org.apache.calcite.linq4j.tree.Expression fieldReference(org.apache.calcite.linq4j.tree.Expression expression,
int field)
PhysTypeFor example given expression=employee and field=2,
generates
employee.deptno
fieldReference in interface PhysTypeexpression - Expressionfield - Ordinal of fieldpublic org.apache.calcite.linq4j.tree.Expression fieldReference(org.apache.calcite.linq4j.tree.Expression expression,
int field,
@Nullable Type storageType)
PhysTypeThis method optimizes for the target storage type (i.e. avoids casts).
For example given expression=employee and field=2,
generates
employee.deptno
fieldReference in interface PhysTypeexpression - Expressionfield - Ordinal of fieldstorageType - optional hint for storage classCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.