You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/12 19:38:57 UTC

[GitHub] [spark] dtenedor commented on a diff in pull request #37430: [SPARK-40000][SQL] Update INSERTs without user-specified fields to not automatically add default values

dtenedor commented on code in PR #37430:
URL: https://github.com/apache/spark/pull/37430#discussion_r944783282


##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -863,25 +863,17 @@ class InsertSuite extends DataSourceTest with SharedSparkSession {
   }
 
   test("Allow user to insert specified columns into insertable view") {
-    withSQLConf(SQLConf.USE_NULLS_FOR_MISSING_DEFAULT_COLUMN_VALUES.key -> "true") {
-      sql("INSERT OVERWRITE TABLE jsonTable SELECT a FROM jt")
-      checkAnswer(
-        sql("SELECT a, b FROM jsonTable"),
-        (1 to 10).map(i => Row(i, null))
-      )
-
-      sql("INSERT OVERWRITE TABLE jsonTable(a) SELECT a FROM jt")
-      checkAnswer(
-        sql("SELECT a, b FROM jsonTable"),
-        (1 to 10).map(i => Row(i, null))
-      )
+    sql("INSERT OVERWRITE TABLE jsonTable(a) SELECT a FROM jt")
+    checkAnswer(
+      sql("SELECT a, b FROM jsonTable"),
+      (1 to 10).map(i => Row(i, null))

Review Comment:
   Good question: no, because that config only applied to `INSERT INTO` commands without explicit user specified column lists. Because this command specifies explicit column `jsonTable(a)` then we add DEFAULT values for the remaining columns in the row. This behavior is the same as before where we added NULL values for the remaining columns in the row.
   
   <img width="938" alt="image" src="https://user-images.githubusercontent.com/99207096/184430799-e76b62f8-8c2b-4cae-9fb1-73da8951ffc6.png">
   



-- 
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-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org