截断表Truncate Table

TRUNCATE TABLE table_name [PARTITION part_spec]

part_spec:
  : (part_col1=value1, part_col2=value2, ...)

删除表中的所有行或表中匹配的分区。Delete all rows from a table or matching partitions in the table. 该表不得为外部表或视图。The table must not be an external table or a view.

PARTITION

部分分区规范,用于匹配要截断的分区。A partial partition spec to match partitions to be truncated. 在 Spark 2.0 中,仅支持使用 Hive 格式创建的表。In Spark 2.0, this is supported only for tables created using the Hive format. 从 Spark 2.1 开始,还支持数据源表。Since Spark 2.1, data source tables are also supported. 不支持增量表。Not supported for Delta tables.