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/12/05 04:02:17 UTC

[GitHub] [spark] ulysses-you commented on a diff in pull request #38875: [SPARK-40988][SQL][TEST] Test case for insert partition should verify value

ulysses-you commented on code in PR #38875:
URL: https://github.com/apache/spark/pull/38875#discussion_r1039123347


##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -2313,6 +2313,33 @@ class InsertSuite extends DataSourceTest with SharedSparkSession {
       }
     }
   }
+
+  test("SPARK-40988: Test case for insert partition should verify value") {
+    val tableName = "partition_table"
+    withTable(tableName) {
+      sql(s"DROP TABLE IF EXISTS $tableName")
+      sql(s"CREATE TABLE $tableName (id INT, name STRING) USING PARQUET PARTITIONED BY (age INT)")
+
+      sql(s"INSERT INTO TABLE $tableName PARTITION(age=1) VALUES (1, 'ABC')")
+      checkAnswer(spark.table(s"$tableName"), Row(1, "ABC", 1))
+
+      checkError(
+        exception = intercept[SparkNumberFormatException] {
+          sql(s"INSERT INTO TABLE $tableName PARTITION(age='aaa') VALUES (1, 'ABC')")

Review Comment:
   Seems this command would fail even before. I guess you want to test insert into hive table ?
   ```scala
   sql(s"CREATE TABLE $tableName (id INT, name STRING) STORED PARQUET PARTITIONED BY (age INT)")
   
   withSQLConf(HiveUtils.CONVERT_INSERTING_PARTITIONED_TABLE.key -> "false") {
     ...
   }
   ```



##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -2313,6 +2313,33 @@ class InsertSuite extends DataSourceTest with SharedSparkSession {
       }
     }
   }
+
+  test("SPARK-40988: Test case for insert partition should verify value") {
+    val tableName = "partition_table"
+    withTable(tableName) {
+      sql(s"DROP TABLE IF EXISTS $tableName")

Review Comment:
   unnecessary



-- 
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