Class SqlTypeNameSpec

java.lang.Object
org.apache.calcite.sql.SqlTypeNameSpec
Direct Known Subclasses:
SqlBasicTypeNameSpec, SqlCollectionTypeNameSpec, SqlMapTypeNameSpec, SqlRowTypeNameSpec, SqlUserDefinedTypeNameSpec

public abstract class SqlTypeNameSpec extends Object
A SqlTypeNameSpec is a type name specification that allows user to customize sql node unparsing and data type deriving.

To customize sql node unparsing, override the method unparse(SqlWriter, int, int).

To customize data type deriving, override the method deriveType(SqlValidator).

  • Constructor Details

    • SqlTypeNameSpec

      protected SqlTypeNameSpec(SqlIdentifier name, SqlParserPos pos)
      Creates a SqlTypeNameSpec.
      Parameters:
      name - Name of the type
      pos - Parser position, must not be null
  • Method Details

    • deriveType

      public abstract RelDataType deriveType(SqlValidator validator)
      Derive type from this SqlTypeNameSpec.
      Parameters:
      validator - The sql validator
      Returns:
      the RelDataType instance, throws exception if we could not deduce the type
    • unparse

      public abstract void unparse(SqlWriter writer, int leftPrec, int rightPrec)
      Writes a SQL representation of this spec to a writer.
    • equalsDeep

      public abstract boolean equalsDeep(SqlTypeNameSpec spec, Litmus litmus)
      Returns whether this spec is structurally equivalent to another spec.
    • getParserPos

      public SqlParserPos getParserPos()
    • getTypeName

      public SqlIdentifier getTypeName()