Class RowSignatures

java.lang.Object
org.apache.druid.sql.calcite.table.RowSignatures

public class RowSignatures extends Object
Utility functions for working with RowSignature.
  • 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" StringComparator for 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 Calcite RelDataType corresponding to a RowSignature. 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 Calcite RelDataType corresponding to a RowSignature. 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 Calcite RelDataType corresponding to a ColumnType
    • makeComplexType

      public static org.apache.calcite.rel.type.RelDataType makeComplexType(org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, ColumnType columnType, boolean isNullable)
      Creates a RowSignatures.ComplexSqlType using the supplied RelDataTypeFactory to ensure that the RowSignatures.ComplexSqlType is 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)