[
https://issues.apache.org/jira/browse/SPARK-7125?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sean Owen resolved SPARK-7125.
------------------------------
Resolution: Not A Problem
For a non-existent input, some flavor of "file not found exception" is correct,
and this is the standard exception you would expect from Hadoop-related APIs.
You don't get the same exception with an empty file, actually. It's
"java.lang.UnsupportedOperationException: empty collection" This is consistent
with, say {{Seq[Int]().head}} throwing the same. You can {{take(1)}} in this
case, which returns _at most_ the desired number of elements, so would return
an empty array for empty input.
> textFile().first() on empty files raises ENOENT
> -----------------------------------------------
>
> Key: SPARK-7125
> URL: https://issues.apache.org/jira/browse/SPARK-7125
> Project: Spark
> Issue Type: Bug
> Reporter: Sam Steingold
>
> The two calls:
> # {{sc.textFile("existing-empty-file").first()}} and
> # {{sc.textFile("non-existent-file").first()}}
> raise the same exception:
> {{"org.apache.hadoop.mapred.InvalidInputException: Input path does not
> exist"}}
> The former should raise a different exception or return {{null}}.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]