[
https://issues.apache.org/jira/browse/SPARK-31962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17234596#comment-17234596
]
Apache Spark commented on SPARK-31962:
--------------------------------------
User 'HeartSaVioR' has created a pull request for this issue:
https://github.com/apache/spark/pull/30411
> Provide modifiedAfter and modifiedBefore options when filtering from a
> batch-based file data source
> ---------------------------------------------------------------------------------------------------
>
> Key: SPARK-31962
> URL: https://issues.apache.org/jira/browse/SPARK-31962
> Project: Spark
> Issue Type: Improvement
> Components: SQL
> Affects Versions: 3.1.0
> Reporter: Christopher Highman
> Priority: Minor
>
> Two new options, _modifiiedBefore_ and _modifiedAfter_, is provided expecting
> a value in 'YYYY-MM-DDTHH:mm:ss' format. _PartioningAwareFileIndex_ considers
> these options during the process of checking for files, just before
> considering applied _PathFilters_ such as {{pathGlobFilter.}} In order to
> filter file results, a new PathFilter class was derived for this purpose.
> General house-keeping around classes extending PathFilter was performed for
> neatness. It became apparent support was needed to handle multiple potential
> path filters. Logic was introduced for this purpose and the associated tests
> written.
>
> When loading files from a data source, there can often times be thousands of
> file within a respective file path. In many cases I've seen, we want to start
> loading from a folder path and ideally be able to begin loading files having
> modification dates past a certain point. This would mean out of thousands of
> potential files, only the ones with modification dates greater than the
> specified timestamp would be considered. This saves a ton of time
> automatically and reduces significant complexity managing this in code.
>
> *Example Usages*
> _Load all CSV files modified after date:_
> {{spark.read.format("csv").option("modifiedAfter","2020-06-15T05:00:00").load()}}
> _Load all CSV files modified before date:_
> {{spark.read.format("csv").option("modifiedBefore","2020-06-15T05:00:00").load()}}
> _Load all CSV files modified between two dates:_
> {{spark.read .format("csv") .option("modifiedAfter","2019-01-15T05:00:00")
> .option("modifiedBefore","2020-06-15T05:00:00") .load()}}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]