dtenedor commented on code in PR #44302:
URL: https://github.com/apache/spark/pull/44302#discussion_r1423244953
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala:
##########
@@ -374,6 +374,7 @@ case class AlterTableChangeColumnCommand(
// TODO: support change column name/dataType/metadata/position.
override def run(sparkSession: SparkSession): Seq[Row] = {
val catalog = sparkSession.sessionState.catalog
+ catalog.refreshTable(tableName)
Review Comment:
This is done.
##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -2608,6 +2608,25 @@ class InsertSuite extends DataSourceTest with
SharedSparkSession {
}
}
+ test("SPARK-46370: Querying a table should not invalidate the column
defaults") {
+ withTable("t") {
+ spark.sql("CREATE TABLE t(i INT, s STRING DEFAULT 'def') USING CSV")
+ spark.sql("INSERT INTO t SELECT 1, DEFAULT")
+ spark.sql("ALTER TABLE t ALTER COLUMN s DROP DEFAULT")
+ spark.sql("INSERT INTO t SELECT 2, DEFAULT")
+ val results = spark.table("t").collect()
Review Comment:
This is done.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]