You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/03/25 16:28:37 UTC
[GitHub] [spark] zsxwing commented on a change in pull request #31638: [SPARK-34526][SS] Skip checking glob path in FileStreamSink.hasMetadata
zsxwing commented on a change in pull request #31638:
URL: https://github.com/apache/spark/pull/31638#discussion_r601648719
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/FileStreamSink.scala
##########
@@ -43,12 +44,23 @@ object FileStreamSink extends Logging {
path match {
case Seq(singlePath) =>
val hdfsPath = new Path(singlePath)
- val fs = hdfsPath.getFileSystem(hadoopConf)
- if (fs.isDirectory(hdfsPath)) {
- val metadataPath = getMetadataLogPath(fs, hdfsPath, sqlConf)
- fs.exists(metadataPath)
- } else {
- false
+ if (SparkHadoopUtil.get.isGlobPath(hdfsPath)) {
Review comment:
We cannot do this. For example, the following test works today. But if you change this, it would be broken.
```
test("foo") {
withTempDir { tempDir =>
val path = new java.io.File(tempDir, "[]")
val chk = new java.io.File(tempDir, "chk")
val q = spark.readStream.format("rate").load().writeStream.format("parquet")
.trigger(org.apache.spark.sql.streaming.Trigger.Once())
.option("checkpointLocation", chk.getCanonicalPath)
.start(path.getCanonicalPath)
q.awaitTermination()
assert(SparkHadoopUtil.get.isGlobPath(new Path(path.getCanonicalPath)))
val fileIndex = spark.read.format("parquet").load(path.getCanonicalPath)
.queryExecution.executedPlan.collectFirst {
case f: FileSourceScanExec => f.relation.location
}.head
assert(fileIndex.isInstanceOf[MetadataLogFileIndex])
}
}
```
The confusing part is Hadoop uses the same class `Path` for both normal path and glob path. But that's not something we can change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org