Class PhysTypeImpl
- All Implemented Interfaces:
PhysType
PhysType.-
Method Summary
Modifier and TypeMethodDescriptionaccessors(Expression v1, List<Integer> argList) @Nullable Expressioncomparer()Returns a expression that yields a comparer, or null if this type is comparable.component(int fieldOrdinal) Returns the physical type of a given field's component type.convertTo(Expression exp, JavaRowFormat targetFormat) Converts an enumerable of this physical type to an enumerable that uses thetargetFormatfor representing its rows.convertTo(Expression exp, PhysType targetPhysType) Converts an enumerable of this physical type to an enumerable that uses a given physical type for its rows.field(int ordinal) Returns the physical type of a field.fieldClass(int field) Returns the Java class of the field with the given ordinal.booleanfieldNullable(int field) Returns whether a given field allows null values.fieldReference(Expression expression, int field) Generates a reference to a given field in an expression.fieldReference(Expression expression, int field, @Nullable Type storageType) Generates a reference to a given field in an expression.generateAccessor(List<Integer> fields) Generates an accessor function for a given list of fields.generateAccessorWithoutNulls(List<Integer> fields) generateCollationKey(List<RelFieldCollation> collations) Returns a lambda to create a collation key and a comparator.generateComparator(RelCollation collation) Returns a comparator.generateMergeJoinComparator(RelCollation collation) Similar toPhysType.generateComparator(RelCollation), but with some specificities for MergeJoin algorithm: it will not consider twonullvalues as equal.generateSelector(ParameterExpression parameter, List<Integer> fields) Generates a selector for the given fields from an expression, with the default row format.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.generateSelector(ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) Generates a lambda expression that is a selector for the given fields from an expression.Returns the format.getJavaFieldType(int index) Returns the Java class that is used to store the field with the given ordinal.Returns the Java type (often a Class) that represents a row.Returns the SQL row type.Returns the type factory.makeNullable(boolean nullable) Returns a copy of this type that allows nulls ifnullableis true.static PhysTypeof(JavaTypeFactory typeFactory, RelDataType rowType, JavaRowFormat format) static PhysTypeof(JavaTypeFactory typeFactory, RelDataType rowType, JavaRowFormat format, boolean optimize) 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.project(List<Integer> integers, JavaRowFormat format) Projects a given collection of fields from this input record, into a particular preferred output format.record(List<Expression> expressions) Generates an expression that creates a record for a row, initializing its fields with the given expressions.selector(ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) Generates a selector for the given fields from an expression.
-
Method Details
-
of
-
of
public static PhysType of(JavaTypeFactory typeFactory, RelDataType rowType, JavaRowFormat format, boolean optimize) -
getFormat
Description copied from interface:PhysTypeReturns the format. -
getTypeFactory
Description copied from interface:PhysTypeReturns the type factory.- Specified by:
getTypeFactoryin interfacePhysType
-
project
Description copied from interface:PhysTypeProjects a given collection of fields from this input record, into a particular preferred output format. The output format is optimized if there are 0 or 1 fields. -
project
Description copied from interface:PhysTypeProjects a given collection of fields from this input record, optionally with indicator fields, into a particular preferred output format.The output format is optimized if there are 0 or 1 fields and indicators are disabled.
-
generateSelector
Description copied from interface:PhysTypeGenerates a selector for the given fields from an expression, with the default row format.- Specified by:
generateSelectorin interfacePhysType
-
generateSelector
public Expression generateSelector(ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) Description copied from interface:PhysTypeGenerates a lambda expression that is a selector for the given fields from an expression.- Specified by:
generateSelectorin interfacePhysType
-
generateSelector
public Expression generateSelector(ParameterExpression parameter, List<Integer> fields, List<Integer> usedFields, JavaRowFormat targetFormat) Description copied from interface:PhysTypeGenerates a lambda expression that is a selector for the given fields from an expression.usedFieldsmust be a subset offields. For each field, there is a corresponding indicator field. If a field is used, its value is assigned and its indicator is leftfalse. If a field is not used, its value is not assigned and its indicator is set totrue; This will become a value of 1 whenGROUPING(field)is called.- Specified by:
generateSelectorin interfacePhysType
-
selector
public Pair<Type,List<Expression>> selector(ParameterExpression parameter, List<Integer> fields, JavaRowFormat targetFormat) Description copied from interface:PhysTypeGenerates a selector for the given fields from an expression. Only used by EnumerableWindow. -
accessors
-
makeNullable
Description copied from interface:PhysTypeReturns a copy of this type that allows nulls ifnullableis true.- Specified by:
makeNullablein interfacePhysType
-
convertTo
Description copied from interface:PhysTypeConverts an enumerable of this physical type to an enumerable that uses a given physical type for its rows. -
convertTo
Description copied from interface:PhysTypeConverts an enumerable of this physical type to an enumerable that uses thetargetFormatfor representing its rows. -
generateCollationKey
Description copied from interface:PhysTypeReturns a lambda to create a collation key and a comparator. The comparator is sometimes null.- Specified by:
generateCollationKeyin interfacePhysType
-
generateComparator
Description copied from interface:PhysTypeReturns a comparator. Unlike the comparator returned byPhysType.generateCollationKey(java.util.List), this comparator acts on the whole element.- Specified by:
generateComparatorin interfacePhysType
-
generateMergeJoinComparator
Description copied from interface:PhysTypeSimilar toPhysType.generateComparator(RelCollation), but with some specificities for MergeJoin algorithm: it will not consider twonullvalues as equal.- Specified by:
generateMergeJoinComparatorin interfacePhysType- See Also:
-
getRowType
Description copied from interface:PhysTypeReturns the SQL row type.- Specified by:
getRowTypein interfacePhysType
-
record
Description copied from interface:PhysTypeGenerates an expression that creates a record for a row, initializing its fields with the given expressions. There must be one expression per field. -
getJavaRowType
Description copied from interface:PhysTypeReturns the Java type (often a Class) that represents a row. For example, in one row format, always returnsObject[].class.- Specified by:
getJavaRowTypein interfacePhysType
-
getJavaFieldType
Description copied from interface:PhysTypeReturns the Java class that is used to store the field with the given ordinal.For instance, when the java row type is
Object[], the java field type isObjecteven if the field is not nullable.- Specified by:
getJavaFieldTypein interfacePhysType
-
component
Description copied from interface:PhysTypeReturns the physical type of a given field's component type. -
field
Description copied from interface:PhysTypeReturns the physical type of a field. -
comparer
Description copied from interface:PhysTypeReturns a expression that yields a comparer, or null if this type is comparable. -
fieldClass
Description copied from interface:PhysTypeReturns the Java class of the field with the given ordinal.- Specified by:
fieldClassin interfacePhysType
-
fieldNullable
public boolean fieldNullable(int field) Description copied from interface:PhysTypeReturns whether a given field allows null values.- Specified by:
fieldNullablein interfacePhysType
-
generateAccessor
Description copied from interface:PhysTypeGenerates an accessor function for a given list of fields. The resulting object is aList(implementingObject.hashCode()andObject.equals(Object)per that interface) and also implementsComparable.For example:
new Function1<Employee, Object[]> { public Object[] apply(Employee v1) { return FlatLists.of(v1.<fieldN>, v1.<fieldM>); } }- Specified by:
generateAccessorin interfacePhysType
-
generateAccessorWithoutNulls
Description copied from interface:PhysTypeSimilar toPhysType.generateAccessor(List), but if one of the fields isnull, it will returnnull.For example:
new Function1<Employee, Object[]> { public Object[] apply(Employee v1) { return v1.<fieldN> == null ? null : v1.<fieldM> == null ? null : FlatLists.of(v1.<fieldN>, v1.<fieldM>); } }- Specified by:
generateAccessorWithoutNullsin interfacePhysType
-
fieldReference
Description copied from interface:PhysTypeGenerates a reference to a given field in an expression.For example given
expression=employeeandfield=2, generatesemployee.deptno- Specified by:
fieldReferencein interfacePhysType- Parameters:
expression- Expressionfield- Ordinal of field- Returns:
- Expression to access the field of the expression
-
fieldReference
Description copied from interface:PhysTypeGenerates a reference to a given field in an expression.This method optimizes for the target storage type (i.e. avoids casts).
For example given
expression=employeeandfield=2, generatesemployee.deptno- Specified by:
fieldReferencein interfacePhysType- Parameters:
expression- Expressionfield- Ordinal of fieldstorageType- optional hint for storage class- Returns:
- Expression to access the field of the expression
-