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 2023/01/13 11:23:02 UTC

[GitHub] [spark] HyukjinKwon commented on a diff in pull request #39553: [SPARK-42041][SPARK-42013][CONNECT][PYTHON] DataFrameReader should support list of paths

HyukjinKwon commented on code in PR #39553:
URL: https://github.com/apache/spark/pull/39553#discussion_r1069276475


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -668,10 +669,16 @@ class SparkConnectPlanner(session: SparkSession) {
             case other => throw InvalidPlanInput(s"Invalid schema $other")
           }
         }
-        reader.load().queryExecution.analyzed
+        if (rel.getDataSource.getPathsCount == 0) {
+          reader.load().queryExecution.analyzed
+        } else if (rel.getDataSource.getPathsCount == 1) {
+          reader.load(rel.getDataSource.getPaths(0)).queryExecution.analyzed
+        } else {
+          reader.load(rel.getDataSource.getPathsList.asScala: _*).queryExecution.analyzed
+        }

Review Comment:
   Can we just call:
   
   ```scala
   reader.load(rel.getDataSource.getPathsList.asScala: _*).queryExecution.analyzed
   ```
   
   alone without checking the length?



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