Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/20057#discussion_r168970903
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/jdbc/TeradataDialect.scala ---
@@ -31,4 +31,19 @@ private case object TeradataDialect extends JdbcDialect {
case BooleanType => Option(JdbcType("CHAR(1)", java.sql.Types.CHAR))
case _ => None
}
+
+ override def isCascadingTruncateTable(): Option[Boolean] = Some(false)
+
+ /**
+ * The SQL query used to truncate a table.
+ * @param table The table to truncate.
+ * @param cascade Whether or not to cascade the truncation. Default
value is the
+ * value of isCascadingTruncateTable(). Ignored for
Teradata as it is unsupported
+ * @return The SQL query to use for truncating a table
+ */
+ override def getTruncateQuery(
+ table: String,
+ cascade: Option[Boolean] = isCascadingTruncateTable): String = {
+ s"TRUNCATE TABLE $table"
--- End diff --
At the beginning, I saw `teradata` is missed in your test case. So, I asked
to add that.
But, today, I did double-check that in order to review this line.
Unfortunately, according to Teradata document, `TRUNCATE` syntax is not
documented. And it's not supported according to some old community articles.
- Teradata SQL Reference
-
https://info.teradata.com/HTMLPubs/DB_TTU_16_00/index.html#page/SQL_Reference%2FB035-1146-160K%2Fpds1472240516459.html%23
- Community (DELETE/TRUNCATE COMMAND)
-
https://community.teradata.com/t5/Database/Delete-truncate-command/td-p/434
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]