Github user danielvdende commented on a diff in the pull request: https://github.com/apache/spark/pull/19911#discussion_r155622687 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/jdbc/DB2Dialect.scala --- @@ -48,5 +48,7 @@ private object DB2Dialect extends JdbcDialect { case _ => None } - override def isCascadingTruncateTable(): Option[Boolean] = Some(false) + override def getTruncateQuery(table: String): String = { + s"TRUNCATE $table" --- End diff -- The `JdbcDialect` object now no longer provides a default implementation for `getTruncateQuery` (as per @dongjoon-hyun 's suggestion). The reason is that this explicitly forces dialects to implement a truncate operation without side effects. One thing I don't like about this solution is the code duplication across dialects. But it does prevent dialects from inheriting default behaviour and (accidentally) truncating with side effects.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org