Not everything is exposed as a function for Python or Java/Scala. Some operations are SQL-only, like OPTIMIZE
for example. If you want to truncate table, you have two choices:
spark.sql("TRUNCATE TABLE <name>")
or
spark.sql("TRUNCATE TABLE delta.`<path>`")
df = spark.read.format("delta").load("<path>")
df.limit(0).write.mode("overwrite").format("delta").save("<path>")
query = "TRUNCATE TABLE <name>"
sqlContext.sql(query)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.