Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ object FileStreamSink extends Logging {

path match {
case Seq(singlePath) =>
val hdfsPath = new Path(singlePath)
try {
val hdfsPath = new Path(singlePath)
val fs = hdfsPath.getFileSystem(hadoopConf)
if (fs.getFileStatus(hdfsPath).isDirectory) {
val metadataPath = getMetadataLogPath(fs, hdfsPath, sqlConf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,19 @@ abstract class FileStreamSinkSuite extends StreamTest {
}
}
}

test("SPARK-48991: Move path initialization into try-catch block") {
val logAppender = new LogAppender("Assume no metadata directory.")
Seq(null, "", "file:tmp").foreach { path =>
withLogAppender(logAppender) {
assert(!FileStreamSink.hasMetadata(Seq(path), spark.sessionState.newHadoopConf(), conf))
}

assert(logAppender.loggingEvents.map(_.getMessage.getFormattedMessage).contains(
"Assume no metadata directory. Error while looking for metadata directory in the path:" +
s" $path."))
}
}
}

object PendingCommitFilesTrackingManifestFileCommitProtocol {
Expand Down