Class DerbyDialect

Object
org.apache.spark.sql.jdbc.JdbcDialect
org.apache.spark.sql.jdbc.DerbyDialect
All Implemented Interfaces:
Serializable, org.apache.spark.internal.Logging, NoLegacyJDBCError, scala.Equals, scala.Product

public class DerbyDialect extends JdbcDialect implements NoLegacyJDBCError, scala.Product, Serializable
See Also:
  • Constructor Details

    • DerbyDialect

      public DerbyDialect()
  • Method Details

    • apply

      public abstract static R apply()
    • toString

      public static String toString()
    • canHandle

      public boolean canHandle(String url)
      Description copied from class: JdbcDialect
      Check if this dialect instance can handle a certain jdbc url.
      Specified by:
      canHandle in class JdbcDialect
      Parameters:
      url - the jdbc url.
      Returns:
      True if the dialect can be applied on the given jdbc url.
    • isSupportedFunction

      public boolean isSupportedFunction(String funcName)
      Description copied from class: JdbcDialect
      Returns whether the database supports function.
      Overrides:
      isSupportedFunction in class JdbcDialect
      Parameters:
      funcName - Upper-cased function name
      Returns:
      True if the database supports function.
    • getCatalystType

      public scala.Option<DataType> getCatalystType(int sqlType, String typeName, int size, MetadataBuilder md)
      Description copied from class: JdbcDialect
      Get the custom datatype mapping for the given jdbc meta information.

      Guidelines for mapping database defined timestamps to Spark SQL timestamps:

      • TIMESTAMP WITHOUT TIME ZONE if preferTimestampNTZ -> TimestampNTZType
      • TIMESTAMP WITHOUT TIME ZONE if !preferTimestampNTZ -> TimestampType(LTZ)
      • TIMESTAMP WITH TIME ZONE -> TimestampType(LTZ)
      • TIMESTAMP WITH LOCAL TIME ZONE -> TimestampType(LTZ)
      • If the TIMESTAMP cannot be distinguished by sqlType and typeName, preferTimestampNTZ is respected for now, but we may need to add another option in the future if necessary.

      Overrides:
      getCatalystType in class JdbcDialect
      Parameters:
      sqlType - Refers to Types constants, or other constants defined by the target database, e.g. -101 is Oracle's TIMESTAMP WITH TIME ZONE type. This value is returned by ResultSetMetaData.getColumnType(int).
      typeName - The column type name used by the database (e.g. "BIGINT UNSIGNED"). This is sometimes used to determine the target data type when sqlType is not sufficient if multiple database types are conflated into a single id. This value is returned by ResultSetMetaData.getColumnTypeName(int).
      size - The size of the type, e.g. the maximum precision for numeric types, length for character string, etc. This value is returned by ResultSetMetaData.getPrecision(int).
      md - Result metadata associated with this type. This contains additional information from ResultSetMetaData or user specified options.
      Returns:
      An option the actual DataType (subclasses of DataType) or None if the default type mapping should be used.
    • getJDBCType

      public scala.Option<JdbcType> getJDBCType(DataType dt)
      Description copied from class: JdbcDialect
      Retrieve the jdbc / sql type for a given datatype.
      Overrides:
      getJDBCType in class JdbcDialect
      Parameters:
      dt - The datatype (e.g. StringType)
      Returns:
      The new JdbcType if there is an override for this DataType
    • isCascadingTruncateTable

      public scala.Option<Object> isCascadingTruncateTable()
      Description copied from class: JdbcDialect
      Return Some[true] iff TRUNCATE TABLE causes cascading default. Some[true] : TRUNCATE TABLE causes cascading. Some[false] : TRUNCATE TABLE does not cause cascading. None: The behavior of TRUNCATE TABLE is unknown (default).
      Overrides:
      isCascadingTruncateTable in class JdbcDialect
      Returns:
      (undocumented)
    • renameTable

      public String renameTable(Identifier oldTable, Identifier newTable)
      Description copied from class: JdbcDialect
      Rename an existing table.

      Overrides:
      renameTable in class JdbcDialect
      Parameters:
      oldTable - The existing table.
      newTable - New name of the table.
      Returns:
      The SQL statement to use for renaming the table.
    • getTableCommentQuery

      public String getTableCommentQuery(String table, String comment)
      Overrides:
      getTableCommentQuery in class JdbcDialect
    • getUpdateColumnNullabilityQuery

      public String getUpdateColumnNullabilityQuery(String tableName, String columnName, boolean isNullable)
      Overrides:
      getUpdateColumnNullabilityQuery in class JdbcDialect
    • getLimitClause

      public String getLimitClause(Integer limit)
      Description copied from class: JdbcDialect
      Returns the LIMIT clause for the SELECT statement
      Overrides:
      getLimitClause in class JdbcDialect
      Parameters:
      limit - (undocumented)
      Returns:
      (undocumented)