huaxingao commented on a change in pull request #30041:
URL: https://github.com/apache/spark/pull/30041#discussion_r505202754



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
##########
@@ -223,8 +223,9 @@ class JDBCTableCatalogSuite extends QueryTest with 
SharedSparkSession {
 
   test("alter table ... drop column") {
     withTable("h2.test.alt_table") {
-      sql("CREATE TABLE h2.test.alt_table (C1 INTEGER, C2 INTEGER) USING _")
+      sql("CREATE TABLE h2.test.alt_table (C1 INTEGER, C2 INTEGER, c3 INTEGER) 
USING _")
       sql("ALTER TABLE h2.test.alt_table DROP COLUMN C1")
+      sql("ALTER TABLE h2.test.alt_table DROP COLUMN c3")

Review comment:
       Without fix (with unquoted column name), this throws the following 
Exception:
   ```
   Failed table altering: test.alt_table;
   org.apache.spark.sql.AnalysisException: Failed table altering: 
test.alt_table;
        at 
org.apache.spark.sql.jdbc.JdbcDialect.classifyException(JdbcDialects.scala:268)
   Caused by: org.h2.jdbc.JdbcSQLException: Column "C3" not found; SQL 
statement:
   ALTER TABLE "test"."alt_table" DROP COLUMN c3 [42122-195]
   ```

##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
##########
@@ -245,10 +246,11 @@ class JDBCTableCatalogSuite extends QueryTest with 
SharedSparkSession {
 
   test("alter table ... update column type") {
     withTable("h2.test.alt_table") {
-      sql("CREATE TABLE h2.test.alt_table (ID INTEGER) USING _")
+      sql("CREATE TABLE h2.test.alt_table (ID INTEGER, deptno INTEGER) USING 
_")
       sql("ALTER TABLE h2.test.alt_table ALTER COLUMN id TYPE DOUBLE")
+      sql("ALTER TABLE h2.test.alt_table ALTER COLUMN deptno TYPE DOUBLE")

Review comment:
       Without fix (with unquoted column name), this throws the following 
Exception:
   ```
   Failed table altering: test.alt_table;
   org.apache.spark.sql.AnalysisException: Failed table altering: 
test.alt_table;
        at 
org.apache.spark.sql.jdbc.JdbcDialect.classifyException(JdbcDialects.scala:268)
     Caused by: org.h2.jdbc.JdbcSQLException: Column "DEPTNO" not found; SQL 
statement:
   ALTER TABLE "test"."alt_table" ALTER COLUMN deptno DOUBLE PRECISION 
[42122-195]
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to