You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/12/11 13:11:01 UTC

[jira] [Commented] (SPARK-20568) Delete files after processing in structured streaming

    [ https://issues.apache.org/jira/browse/SPARK-20568?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16717096#comment-16717096 ] 

ASF GitHub Bot commented on SPARK-20568:
----------------------------------------

gaborgsomogyi 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_r240569488
 
 

 ##########
 File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/FileStreamSource.scala
 ##########
 @@ -329,4 +345,124 @@ object FileStreamSource {
 
     def size: Int = map.size()
   }
+
+  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 (baseArchivePath.get.depth() <= 2) {
 
 Review comment:
   I just don't understand this hardcoded 2. Maybe it belongs to `isArchiveFileMatchedAgainstSourcePattern`?
   If that can go away maybe it will be one condition only, not sure.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> Delete files after processing in structured streaming
> -----------------------------------------------------
>
>                 Key: SPARK-20568
>                 URL: https://issues.apache.org/jira/browse/SPARK-20568
>             Project: Spark
>          Issue Type: New Feature
>          Components: Structured Streaming
>    Affects Versions: 2.1.0, 2.2.1
>            Reporter: Saul Shanabrook
>            Priority: Major
>
> It would be great to be able to delete files after processing them with structured streaming.
> For example, I am reading in a bunch of JSON files and converting them into Parquet. If the JSON files are not deleted after they are processed, it quickly fills up my hard drive. I originally [posted this on Stack Overflow|http://stackoverflow.com/q/43671757/907060] and was recommended to make a feature request for it. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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