viirya commented on code in PR #50593: URL: https://github.com/apache/spark/pull/50593#discussion_r2048303788
########## sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/ColumnDefaultValue.java: ########## @@ -33,25 +34,20 @@ * data that do not have these new columns. */ @Evolving -public class ColumnDefaultValue { - private String sql; - private Literal<?> value; +public class ColumnDefaultValue extends DefaultValue { + private final Literal<?> value; public ColumnDefaultValue(String sql, Literal<?> value) { - this.sql = sql; - this.value = value; + this(sql, null /* no expression */, value); } - /** - * Returns the SQL string (Spark SQL dialect) of the default value expression. This is the - * original string contents of the SQL expression specified at the time the column was created in - * a CREATE TABLE, REPLACE TABLE, or ADD COLUMN command. For example, for - * "CREATE TABLE t (col INT DEFAULT 40 + 2)", this returns the string literal "40 + 2" (without - * quotation marks). - */ - @Nonnull - public String getSql() { - return sql; + public ColumnDefaultValue(Expression expr, Literal<?> value) { + this(null /* no sql */, expr, value); + } + + public ColumnDefaultValue(String sql, Expression expr, Literal<?> value) { Review Comment: Hmm, as now it has `Expression`, why we still need `Literal`? Cannot the expression be a literal? Seems it can just have `Expression`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org