Class DefaultValue

Object
org.apache.spark.sql.connector.catalog.DefaultValue
Direct Known Subclasses:
ColumnDefaultValue

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

Connectors can define default values using either a SQL string (Spark SQL dialect) or a more portable connector expression, whose semantics follow the ANSI SQL standard.

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.1.0
  • Constructor Details

    • DefaultValue

      public DefaultValue(String sql)
    • DefaultValue

      public DefaultValue(Expression expr)
    • DefaultValue

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

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSql

      @Nullable public final String getSql()
      Returns the SQL representation, if provided.
    • getExpression

      @Nullable public final Expression getExpression()
      Returns the connector expression, if provided.
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object