Class GenerationExpression

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

@Evolving public class GenerationExpression extends Object
A class that represents generated column expressions.

Connectors can define generated columns 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.3.0
  • Constructor Details

    • GenerationExpression

      public GenerationExpression(String sql)
    • GenerationExpression

      public GenerationExpression(Expression expr)
    • GenerationExpression

      public GenerationExpression(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