Skip to content
Prev Previous commit
Add checkFileExist again
CheckFileExist was avoided at 239cfa4 after discussing #23288 (comment).
But, that change turned out to be wrong because we should not check if argument checkFileExist is false.
Test https://github.com/apache/spark/blob/27e42c1de502da80fa3e22bb69de47fb00158174/sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala#L2555
failed when we avoided checkFileExist, but now successed after this commit.
  • Loading branch information
Hirobe Keiichi committed Jan 4, 2019
commit 92934b41145a82c09d1caf0c5aad85f7a7dcaa23
Original file line number Diff line number Diff line change
Expand Up @@ -560,16 +560,18 @@ case class DataSource(
globPath
}.toSeq

val (filteredOut, filteredIn) = allGlobPath.partition { path =>
InMemoryFileIndex.shouldFilterOut(path.getName)
}
if (filteredOut.nonEmpty) {
if (filteredIn.isEmpty) {
throw new AnalysisException(
s"All paths were ignored:\n${filteredOut.mkString("\n ")}")
} else {
logDebug(
s"Some paths were ignored:\n${filteredOut.mkString("\n ")}")
if (checkFilesExist) {
val (filteredOut, filteredIn) = allGlobPath.partition { path =>
InMemoryFileIndex.shouldFilterOut(path.getName)
}
if (filteredOut.nonEmpty) {
if (filteredIn.isEmpty) {
throw new AnalysisException(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid this could break the existing applications. Currently, when users specify the schema, no exception is thrown, right?

cc @HyukjinKwon @srowen @MaxGekk @cloud-fan

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, it was discussed:

#23288 (comment)
#23288 (review)

I don't have a strong opinion on this. If you think it should be considered as a behaviour change, yea, no objection from me. We can turn it to warning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please submit a follow-up PR to change it to a warning? Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let me make a followup by the end of today (singapore time)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a fair point. It might not have thrown an exception later if it didn't try to infer schema.

s"All paths were ignored:\n${filteredOut.mkString("\n ")}")
} else {
logDebug(
s"Some paths were ignored:\n${filteredOut.mkString("\n ")}")
}
}
}

Expand Down