spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [spark] vanzin commented on a change in pull request #22952: [SPARK-20568][SS] Provide option to clean up completed files in streaming query
Date Wed, 23 Oct 2019 23:57:28 GMT
vanzin commented on a change in pull request #22952: [SPARK-20568][SS] Provide option to clean
up completed files in streaming query
URL: https://github.com/apache/spark/pull/22952#discussion_r338314390
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/FileStreamSource.scala
 ##########
 @@ -330,4 +353,137 @@ object FileStreamSource {
 
     def size: Int = map.size()
   }
+
+  private[sql] class FileStreamSourceCleaner(
+      fileSystem: FileSystem,
+      sourcePath: Path,
+      baseArchivePathString: Option[String]) extends Logging {
+
+    private val sourceGlobFilters: Seq[GlobFilter] = buildSourceGlobFilters(sourcePath)
+
+    private val baseArchivePath: Option[Path] = baseArchivePathString.map(new Path(_))
+
+    def archive(entry: FileEntry): Unit = {
+      require(baseArchivePath.isDefined)
+
+      val curPath = new Path(new URI(entry.path))
+      val curPathUri = curPath.toUri
+
+      val newPath = buildArchiveFilePath(curPathUri)
+
+      if (isArchiveFileMatchedAgainstSourcePattern(newPath)) {
+        logWarning(s"Fail to move $curPath to $newPath - destination matches " +
 
 Review comment:
   nit: you didn't fail to move, you're refusing to do it, which is slightly different.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message