| Modifier and Type | Field and Description |
|---|---|
private List<Class> |
fieldClasses |
(package private) JavaRowFormat |
format |
private Type |
javaRowClass |
private RelDataType |
rowType |
private JavaTypeFactory |
typeFactory |
| Constructor and Description |
|---|
PhysTypeImpl(JavaTypeFactory typeFactory,
RelDataType rowType,
Type javaRowClass,
JavaRowFormat format)
Creates a PhysTypeImpl.
|
| Modifier and Type | Method and Description |
|---|---|
List<Expression> |
accessors(Expression v1,
List<Integer> argList) |
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.
|
Expression |
convertTo(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.
|
Expression |
fieldReference(Expression expression,
int field)
Generates a reference to a given field in an expression.
|
Expression |
fieldReference(Expression expression,
int field,
Type storageType)
Generates a reference to a given field in an expression.
|
private List<Expression> |
fieldReferences(Expression parameter,
List<Integer> fields) |
Expression |
generateAccessor(List<Integer> fields)
Generates an accessor function for a given list of fields.
|
Pair<Expression,Expression> |
generateCollationKey(List<RelFieldCollation> collations)
Returns a lambda to create a collation key and a comparator.
|
Expression |
generateComparator(RelCollation collation)
Returns a comparator.
|
Expression |
generateSelector(ParameterExpression parameter,
List<Integer> fields)
Generates a selector for the given fields from an expression, with the
default row format.
|
Expression |
generateSelector(ParameterExpression parameter,
List<Integer> fields,
JavaRowFormat targetFormat)
Generates a lambda expression that is a selector for the given fields from
an expression.
|
Expression |
generateSelector(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) |
(package private) static PhysType |
of(JavaTypeFactory typeFactory,
Type javaRowClass) |
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.
|
Expression |
record(List<Expression> expressions)
Generates an expression that creates a record for a row, initializing
its fields with the given expressions.
|
Pair<Type,List<Expression>> |
selector(ParameterExpression parameter,
List<Integer> fields,
JavaRowFormat targetFormat)
Generates a selector for the given fields from an expression.
|
private RelDataType |
toStruct(RelDataType type) |
private final JavaTypeFactory typeFactory
private final RelDataType rowType
private final Type javaRowClass
final JavaRowFormat format
PhysTypeImpl(JavaTypeFactory typeFactory, RelDataType rowType, Type javaRowClass, JavaRowFormat format)
public static PhysType of(JavaTypeFactory typeFactory, RelDataType rowType, JavaRowFormat format)
public static PhysType of(JavaTypeFactory typeFactory, RelDataType rowType, JavaRowFormat format, boolean optimize)
static PhysType of(JavaTypeFactory typeFactory, Type javaRowClass)
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 Expression generateSelector(ParameterExpression parameter, List<Integer> fields)
PhysTypegenerateSelector in interface PhysTypepublic Expression generateSelector(ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat)
PhysTypegenerateSelector in interface PhysTypepublic Expression generateSelector(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<Expression>> selector(ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat)
PhysTypepublic List<Expression> accessors(Expression v1, List<Integer> argList)
public PhysType makeNullable(boolean nullable)
PhysTypenullable is
true.makeNullable in interface PhysTypepublic Expression convertTo(Expression exp, PhysType targetPhysType)
PhysTypepublic Pair<Expression,Expression> generateCollationKey(List<RelFieldCollation> collations)
PhysTypegenerateCollationKey in interface PhysTypepublic 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 Expression record(List<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)
PhysTypeprivate RelDataType toStruct(RelDataType type)
public Expression comparer()
PhysTypeprivate List<Expression> fieldReferences(Expression parameter, List<Integer> fields)
public Class fieldClass(int field)
PhysTypefieldClass in interface PhysTypepublic boolean fieldNullable(int field)
PhysTypefieldNullable in interface PhysTypepublic 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 Expression fieldReference(Expression expression, int field)
PhysTypeFor example given expression=employee and field=2,
generates
employee.deptno
fieldReference in interface PhysTypeexpression - Expressionfield - Ordinal of fieldpublic Expression fieldReference(Expression expression, int field, 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–2018 The Apache Software Foundation. All rights reserved.