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/02 08:07:46 UTC

[GitHub] [spark] rangareddy opened a new pull request, #38875: [SPARK-40988][SQL][TEST] Test case for insert partition should verify value

rangareddy opened a new pull request, #38875:
URL: https://github.com/apache/spark/pull/38875

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   This PR adds a **new test** to **validate the partition type value while inserting the partition data** using SQL query.
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   SPARK-40798 Jira will cover validating the partition type value while doing Alter partition. The same Jira will solve the validating of the partition type value while doing the insert partition. So adding a new test case for insert partition.
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   No, test-only.
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   This PR adds only a new Test case.


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


[GitHub] [spark] github-actions[bot] closed pull request #38875: [SPARK-40988][SQL][TEST] Test case for insert partition should verify value

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #38875: [SPARK-40988][SQL][TEST] Test case for insert partition should verify value
URL: https://github.com/apache/spark/pull/38875


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


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

Posted by GitBox <gi...@apache.org>.
rangareddy commented on code in PR #38875:
URL: https://github.com/apache/spark/pull/38875#discussion_r1073104578


##########
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:
   Hi @ulysses-you 
   
   Please review the latest changes.



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


[GitHub] [spark] github-actions[bot] commented on pull request #38875: [SPARK-40988][SQL][TEST] Test case for insert partition should verify value

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #38875:
URL: https://github.com/apache/spark/pull/38875#issuecomment-1552242081

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


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


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

Posted by GitBox <gi...@apache.org>.
ulysses-you commented on code in PR #38875:
URL: https://github.com/apache/spark/pull/38875#discussion_r1066943650


##########
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:
   yeah, can you send a new pr without irrelevant git commit history ? thank you 



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


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

Posted by GitBox <gi...@apache.org>.
rangareddy commented on code in PR #38875:
URL: https://github.com/apache/spark/pull/38875#discussion_r1066754204


##########
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:
   @ulysses-you 
   
   Yes, you are right. I am adding a test case for the insert into the hive table with partitioned data.
   
   The following implementation is correct as per your suggestion?
   
   ```scala
         withSQLConf("spark.sql.hive.convertInsertingPartitionedTable" -> "false") {
           checkError(
             exception = intercept[SparkNumberFormatException] {
               sql(s"INSERT INTO TABLE $tableName PARTITION(age='aaa') VALUES (1, 'ABC')")
             },
             errorClass = "CAST_INVALID_INPUT",
             parameters = Map(
               "ansiConfig" -> "\"spark.sql.ansi.enabled\"",
               "expression" -> "'aaa'",
               "sourceType" -> "\"STRING\"",
               "targetType" -> "\"INT\""),
             context = ExpectedContext(
               fragment = s"INSERT INTO TABLE $tableName PARTITION(age='aaa')",
               start = 0,
               stop = 38 + tableName.length)
           )
         }```



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


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

Posted by GitBox <gi...@apache.org>.
rangareddy commented on PR #38875:
URL: https://github.com/apache/spark/pull/38875#issuecomment-1334912930

   @ulysses - Please review this PR


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


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

Posted by "ulysses-you (via GitHub)" <gi...@apache.org>.
ulysses-you commented on code in PR #38875:
URL: https://github.com/apache/spark/pull/38875#discussion_r1090146633


##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -2315,6 +2315,34 @@ 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"CREATE TABLE $tableName (id INT, name STRING) USING PARQUET PARTITIONED BY (age INT)")

Review Comment:
   `SOTRED AS` rather than `USING `, otherwise it's always a datasource table



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


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

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #38875:
URL: https://github.com/apache/spark/pull/38875#issuecomment-1336066739

   Can one of the admins verify this patch?


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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by "rangareddy (via GitHub)" <gi...@apache.org>.
rangareddy commented on code in PR #38875:
URL: https://github.com/apache/spark/pull/38875#discussion_r1096935799


##########
sql/core/src/test/scala/org/apache/spark/sql/sources/InsertSuite.scala:
##########
@@ -2315,6 +2315,34 @@ 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"CREATE TABLE $tableName (id INT, name STRING) USING PARQUET PARTITIONED BY (age INT)")

Review Comment:
   Sure i will modify and resend the PR.



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