Github user danielvdende commented on a diff in the pull request: https://github.com/apache/spark/pull/20057#discussion_r168922006 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala --- @@ -860,14 +860,41 @@ class JDBCSuite extends SparkFunSuite val db2 = JdbcDialects.get("jdbc:db2://127.0.0.1/db") val h2 = JdbcDialects.get(url) val derby = JdbcDialects.get("jdbc:derby:db") + val oracle = JdbcDialects.get("jdbc:oracle://127.0.0.1/db") + val table = "weblogs" val defaultQuery = s"TRUNCATE TABLE $table" val postgresQuery = s"TRUNCATE TABLE ONLY $table" + assert(MySQL.getTruncateQuery(table) == defaultQuery) assert(Postgres.getTruncateQuery(table) == postgresQuery) assert(db2.getTruncateQuery(table) == defaultQuery) assert(h2.getTruncateQuery(table) == defaultQuery) assert(derby.getTruncateQuery(table) == defaultQuery) + assert(oracle.getTruncateQuery(table) == defaultQuery) + } + + test("SPARK-22880: Truncate table with CASCADE by jdbc dialect") { + // cascade in a truncate should only be applied for databases that support this, + // even if the parameter is passed. + val MySQL = JdbcDialects.get("jdbc:mysql://127.0.0.1/db") --- End diff -- Good point, I saw a few other tests in there (untouched by the PR initially) that had this, fixed those now too.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org