Class CalciteUtils

java.lang.Object
org.apache.beam.sdk.extensions.sql.impl.utils.CalciteUtils

public class CalciteUtils extends Object
Utility methods for Calcite related operations.
  • Field Details

  • Constructor Details

    • CalciteUtils

      public CalciteUtils()
  • Method Details

    • isDateTimeType

      public static boolean isDateTimeType(Schema.FieldType fieldType)
      Returns true if the type is any of the various date time types.
    • isStringType

      public static boolean isStringType(Schema.FieldType fieldType)
    • toSchema

      public static Schema toSchema(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType tableInfo)
      Generate Schema from RelDataType which is used to create table.
    • toSqlTypeName

      public static org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.type.SqlTypeName toSqlTypeName(Schema.FieldType type)
    • toFieldType

      public static Schema.FieldType toFieldType(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.SqlTypeNameSpec sqlTypeName)
    • toFieldType

      public static Schema.FieldType toFieldType(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.sql.type.SqlTypeName sqlTypeName)
    • toField

      public static Schema.Field toField(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeField calciteField)
    • toField

      public static Schema.Field toField(String name, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType calciteType)
    • toFieldType

      public static Schema.FieldType toFieldType(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType calciteType)
    • toCalciteRowType

      public static org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType toCalciteRowType(Schema schema, org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFactory dataTypeFactory)
      Create an instance of RelDataType so it can be used to create a table.
    • toRelDataType

      public static org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType toRelDataType(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFactory dataTypeFactory, Schema.FieldType fieldType)
    • sqlTypeWithAutoCast

      public static org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataType sqlTypeWithAutoCast(org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.type.RelDataTypeFactory typeFactory, Type type)
      SQL-Java type mapping, with specified Beam rules:
      1. redirect AbstractInstant to Date so Calcite can recognize it.
      2. For a list, the component type is needed to create a Sql array type.
      3. For a Map, the component type is needed to create a Sql map type.
      Parameters:
      type -
      Returns:
      Calcite RelDataType