Class DefaultValue

Object
org.apache.spark.sql.connector.catalog.DefaultValue

@Evolving public class DefaultValue extends Object
A class that represents default values.

Connectors can define default values using either a SQL string (Spark SQL dialect) or an expression if the default value can be expressed as a supported connector expression. If both the SQL string and the expression are provided, Spark first attempts to convert the given expression to its internal representation. If the expression cannot be converted, and a SQL string is provided, Spark will fall back to parsing the SQL string.

Since:
4.0.0
  • Constructor Details

    • DefaultValue

      public DefaultValue(String sql)
    • DefaultValue

      public DefaultValue(Expression expr)
    • DefaultValue

      public DefaultValue(String sql, Expression expr)
  • Method Details

    • getSql

      @Nullable public String getSql()
      Returns the SQL representation of the default value (Spark SQL dialect), if provided.
    • getExpression

      @Nullable public Expression getExpression()
      Returns the expression representing the default value, if provided.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object