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 2020/08/18 06:57:19 UTC
[GitHub] [spark] gengliangwang commented on a change in pull request #29437: [SPARK-32621][SQL] 'path' option can cause issues while inferring schema in CSV/JSON datasources
gengliangwang commented on a change in pull request #29437:
URL: https://github.com/apache/spark/pull/29437#discussion_r471954974
##########
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:
There was a time when the `FileIndex` is created in `FileDataSourceV2`, so that the `getPaths` method was in `FileDataSourceV2`. In the current code, it seems fine to move the location of the method.
----------------------------------------------------------------
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