You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sean Owen (JIRA)" <ji...@apache.org> on 2015/04/24 19:31:38 UTC
[jira] [Commented] (SPARK-7124) Add functions to check for file and
directory existence
[ https://issues.apache.org/jira/browse/SPARK-7124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14511387#comment-14511387 ]
Sean Owen commented on SPARK-7124:
----------------------------------
There is already an HDFS API for this, which also works for local files.
> Add functions to check for file and directory existence
> -------------------------------------------------------
>
> Key: SPARK-7124
> URL: https://issues.apache.org/jira/browse/SPARK-7124
> Project: Spark
> Issue Type: Improvement
> Components: Input/Output
> Reporter: Sam Steingold
>
> How do I check that a file or directory exists?
> For file, I was told to do {{sc.textFile().first()}} which seems wrong:
> # it initiates unnecessary i/o which could be huge (what is the file is binary and has no newlines?)
> # it fails for 0-length files (e.g., we write 0-length {{_SUCCESS}} files in directories after they have been successfully written)
> it appears that Spark needs bona file {{isFile}} and {{isDirectory}} methods.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org