Class RowSignatures
java.lang.Object
org.apache.druid.sql.calcite.table.RowSignatures
Utility functions for working with
RowSignature.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classCalciteRelDataTypefor Druid complex columns, to preserve complex type information. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.calcite.rel.type.RelDataTypecolumnTypeToRelDataType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, ColumnType columnType, boolean nullNumeric) Returns a CalciteRelDataTypecorresponding to aColumnTypecomplexTypeChecker(ColumnType complexType) static RowSignaturefromRelDataType(List<String> rowOrder, org.apache.calcite.rel.type.RelDataType rowType) static StringComparatorgetNaturalStringComparator(RowSignature rowSignature, SimpleExtraction simpleExtraction) Return the "natural"StringComparatorfor an extraction from a row signature.static org.apache.calcite.rel.type.RelDataTypemakeComplexType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, ColumnType columnType, boolean isNullable) Creates aRowSignatures.ComplexSqlTypeusing the suppliedRelDataTypeFactoryto ensure that theRowSignatures.ComplexSqlTypeis interned.static org.apache.calcite.rel.type.RelDataTypetoRelDataType(RowSignature rowSignature, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory) Returns a CalciteRelDataTypecorresponding to aRowSignature.static org.apache.calcite.rel.type.RelDataTypetoRelDataType(RowSignature rowSignature, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, boolean typecastTimeColumn) Returns a CalciteRelDataTypecorresponding to aRowSignature.
-
Method Details
-
fromRelDataType
public static RowSignature fromRelDataType(List<String> rowOrder, org.apache.calcite.rel.type.RelDataType rowType) -
getNaturalStringComparator
@Nonnull public static StringComparator getNaturalStringComparator(RowSignature rowSignature, SimpleExtraction simpleExtraction) Return the "natural"StringComparatorfor an extraction from a row signature. This will be a lexicographic comparator for String types and a numeric comparator for Number types. -
toRelDataType
public static org.apache.calcite.rel.type.RelDataType toRelDataType(RowSignature rowSignature, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory) Returns a CalciteRelDataTypecorresponding to aRowSignature. It will typecast __time column to TIMESTAMP irrespective of the type present in the row signature -
toRelDataType
public static org.apache.calcite.rel.type.RelDataType toRelDataType(RowSignature rowSignature, org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, boolean typecastTimeColumn) Returns a CalciteRelDataTypecorresponding to aRowSignature. For columns that are named "__time", it automatically casts it to TIMESTAMP if typecastTimeColumn is set to true -
columnTypeToRelDataType
public static org.apache.calcite.rel.type.RelDataType columnTypeToRelDataType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, ColumnType columnType, boolean nullNumeric) Returns a CalciteRelDataTypecorresponding to aColumnType -
makeComplexType
public static org.apache.calcite.rel.type.RelDataType makeComplexType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, ColumnType columnType, boolean isNullable) Creates aRowSignatures.ComplexSqlTypeusing the suppliedRelDataTypeFactoryto ensure that theRowSignatures.ComplexSqlTypeis interned. This is important because Calcite checks that the references are equal instead of the objects being equivalent.This method uses
ensures that if the type factory is a {@link org.apache.calcite.rel.type.RelDataTypeFactoryImpl} that the type is passed through {@link org.apache.calcite.rel.type.RelDataTypeFactoryImpl#canonize(RelDataType)} which interns the type. -
complexTypeChecker
public static RowSignatures.ComplexSqlSingleOperandTypeChecker complexTypeChecker(ColumnType complexType)
-