You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/11/16 05:17:38 UTC

Re: [PR] [SPARK-45927][PYTHON] Update path handling for Python data source [spark]

cloud-fan commented on code in PR #43809:
URL: https://github.com/apache/spark/pull/43809#discussion_r1395160402


##########
sql/core/src/main/scala/org/apache/spark/sql/DataFrameReader.scala:
##########
@@ -246,7 +246,15 @@ class DataFrameReader private[sql](sparkSession: SparkSession) extends Logging {
     val builder = sparkSession.sharedState.dataSourceManager.lookupDataSource(source)
     // Unless the legacy path option behavior is enabled, the extraOptions here
     // should not include "path" or "paths" as keys.
-    val plan = builder(sparkSession, source, paths, userSpecifiedSchema, extraOptions)
+    // Add path to the options field. Note currently it only supports a single path.
+    val optionsWithPath = if (paths.isEmpty) {
+      extraOptions
+    } else if (paths.length == 1) {
+        extraOptions + ("path" -> paths.head)

Review Comment:
   ```suggestion
         extraOptions + ("path" -> paths.head)
   ```



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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