Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/14086
  
    Let me share my 2 cents here.
    
    `Truncate Table` is very risky. It is fast since RDBMS does not log the 
individual row deletes. That means, we are unable to roll it back in most 
RDBMS. The behaviors are different in different RDBMS vendors. For example, 
    
    1. 
[PostgreSQL](https://www.postgresql.org/docs/9.1/static/sql-truncate.html) 
could truncate all its descendant tables at default, unless we specify `ONLY` 
in the statement.
    
    2. [DB2 
z](https://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/sqlref/src/tpc/db2z_sql_truncate.html)
 can roll it back but the table is still in a truncated state
    
    3. Oracle 11 documents this caution at the very beginning: 
http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_10007.htm 
Unable to roll it back. (Note, [Oracle 12 
](ttps://docs.oracle.com/database/121/SQLRF/statements_10007.htm#SQLRF01707) 
added a new clause CASCADE. By default, the descendant table will not be 
dropped.)
    
    Thus, I am not confident to add such a mode or option into Spark SQL. This 
command is used very rarely in production systems. DBAs should do it manually, 
instead of using the Spark SQL interface.
    
    If the community still thinks we should integrate it into Spark SQL, I am 
also fine. After a quick review, I think the implementation misses the error 
handling. For example, when users try to use `truncate` option in the other 
`SaveMode`. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to