imback82 commented on a change in pull request #29437:
URL: https://github.com/apache/spark/pull/29437#discussion_r472443571
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/FileTable.scala
##########
@@ -34,13 +35,21 @@ import org.apache.spark.sql.util.SchemaUtils
abstract class FileTable(
sparkSession: SparkSession,
- options: CaseInsensitiveStringMap,
+ originalOptions: CaseInsensitiveStringMap,
paths: Seq[String],
userSpecifiedSchema: Option[StructType])
extends Table with SupportsRead with SupportsWrite {
import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._
+ // Options without path-related options from `originalOptions`.
+ protected final lazy val options: CaseInsensitiveStringMap = {
+ val caseInsensitiveMap =
CaseInsensitiveMap(originalOptions.asCaseSensitiveMap.asScala.toMap)
+ val caseInsensitiveMapWithoutPaths = caseInsensitiveMap - "paths" - "path"
+ new CaseInsensitiveStringMap(
+
caseInsensitiveMapWithoutPaths.asInstanceOf[CaseInsensitiveMap[String]].originalMap.asJava)
+ }
Review comment:
I tried to move `getPaths` to `FileTable` here:
https://github.com/apache/spark/pull/29437/commits/15fd313044649031d4919108509e3827301565b7.
That required moving `getName` (which depends on paths) as well, and
`FileTable` needs to have a dependency on `DatasourceRegister` to get
`shortName`. Also, whether to use the original options or options without paths
is still not clear with this approach.
So, I followed @viirya's
[comment](https://github.com/apache/spark/pull/29437#discussion_r471933928)
where options without paths are passed to `FileTable`, which seems to be more
straightforward. The latest commit has this approach.
Please let me know which approach seems better. Thanks!
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]