Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/20057#discussion_r172685274
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala ---
@@ -120,14 +121,30 @@ abstract class JdbcDialect extends Serializable {
* The SQL query that should be used to truncate a table. Dialects can
override this method to
* return a query that is suitable for a particular database. For
PostgreSQL, for instance,
* a different query is used to prevent "TRUNCATE" affecting other
tables.
- * @param table The name of the table.
+ * @param table The table to truncate
* @return The SQL query to use for truncating a table
*/
@Since("2.3.0")
def getTruncateQuery(table: String): String = {
+ getTruncateQuery(table, isCascadingTruncateTable)
+ }
+
+ /**
+ * The SQL query that should be used to truncate a table. Dialects can
override this method to
+ * return a query that is suitable for a particular database. For
PostgreSQL, for instance,
+ * a different query is used to prevent "TRUNCATE" affecting other
tables.
+ * @param table The table to truncate
+ * @param cascade Whether or not to cascade the truncation
+ * @return The SQL query to use for truncating a table
+ */
+ @Since("2.4.0")
+ def getTruncateQuery(
+ table: String,
+ cascade: Option[Boolean] = isCascadingTruncateTable): String = {
s"TRUNCATE TABLE $table"
}
+
--- End diff --
Let's remove this redundant empty line addition.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]