grundprinzip commented on code in PR #38086:
URL: https://github.com/apache/spark/pull/38086#discussion_r999758950


##########
connector/connect/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -91,7 +92,25 @@ class SparkConnectPlanner(plan: proto.Relation, session: 
SparkSession) {
         } else {
           child
         }
-      case _ => throw InvalidPlanInput()
+      case proto.Read.ReadTypeCase.DATA_SOURCE =>
+        if (rel.getDataSource.getFormat == "") {
+          throw InvalidPlanInput("DataSource requires a format")
+        }
+        val localMap = 
CaseInsensitiveMap[String](rel.getDataSource.getOptionsMap.asScala.toMap)
+        if (!localMap.contains("path")) {
+          throw InvalidPlanInput("DataSource requires a path")
+        }
+
+        val reader = session.read
+        reader.format(rel.getDataSource.getFormat)
+        for ((k, v) <- localMap) {
+          reader.option(k, v)
+        }
+        if (rel.getDataSource.getSchema != null) {
+          reader.schema(rel.getDataSource.getSchema)
+        }
+        reader.load().queryExecution.analyzed

Review Comment:
   Thanks I was able to verify this for myself as well using some experiments.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to