cloud-fan commented on code in PR #38086:
URL: https://github.com/apache/spark/pull/38086#discussion_r998888480
##########
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)
+ }
Review Comment:
I like this shorter one line version
--
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]