Udbhav30 commented on a change in pull request #29387: URL: https://github.com/apache/spark/pull/29387#discussion_r467487311
########## File path: core/src/main/scala/org/apache/spark/util/Utils.scala ########## @@ -269,6 +269,23 @@ private[spark] object Utils extends Logging { file.setExecutable(true, true) } + def moveToTrashIfEnabled( + fs: FileSystem, + partitionPath: Path, + trashInterval: Int, + hadoopConf: Configuration): Unit = { + if (trashInterval < 0) { + if (!fs.delete(partitionPath, true)) { + throw new RuntimeException( Review comment: To avoid code duplication i used `moveToTrashIfEnabled` function to handle both `truncate table` and `insert overwrite` This exception is thrown in case of insert overwrite in `sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/InsertIntoHiveTable.scala` If you suggest, i can modify and handle this separately. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org