YannByron commented on a change in pull request #4490:
URL: https://github.com/apache/hudi/pull/4490#discussion_r777172757
##########
File path:
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/TruncateHoodieTableCommand.scala
##########
@@ -36,10 +38,13 @@ class TruncateHoodieTableCommand(
override def run(sparkSession: SparkSession): Seq[Row] = {
val hoodieCatalogTable = HoodieCatalogTable(sparkSession, tableIdentifier)
val properties = hoodieCatalogTable.tableConfig.getProps
- val tablePath = hoodieCatalogTable.tableLocation
- // Delete all data in the table directory
- super.run(sparkSession)
+ try {
+ // Delete all data in the table directory
+ super.run(sparkSession)
Review comment:
According to the process, call the `TruncateTableCommand` in Spark first
and reconstruct the hoodie's table.
Within the `TruncateTableCommand` in Spark, it will delete the related
directories first, and refresh the table which will fail because `.hoodie` dir
has gone and it can't resolve hudi's relation. So I catch this and ignore this.
The related error as following:
```
Cause: org.apache.hudi.exception.TableNotFoundException: Hoodie table not
found in path Unable to find a hudi table for the user provided paths.
at org.apache.hudi.DataSourceUtils.getTablePath(DataSourceUtils.java:85)
at org.apache.hudi.DefaultSource.createRelation(DefaultSource.scala:103)
at
org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:348)
at
org.apache.spark.sql.execution.datasources.FindDataSourceTable.$anonfun$readDataSourceTable$1(DataSourceStrategy.scala:252)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]