amaliujia commented on code in PR #38086:
URL: https://github.com/apache/spark/pull/38086#discussion_r988342282
##########
connect/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -81,7 +81,26 @@ class SparkConnectPlanner(plan: proto.Relation, session:
SparkSession) {
} else {
child
}
- case _ => throw InvalidPlanInput()
+ case proto.Read.ReadTypeCase.FILE_DATA_SOURCE =>
+ val reader = session.read
+ if (rel.getFileDataSource.getFormat != null) {
+ reader.format(rel.getFileDataSource.getFormat)
+ }
+ if (rel.getFileDataSource.getSchema != null) {
+ reader.schema(rel.getFileDataSource.getSchema)
+ }
+ if (rel.getFileDataSource.getOptionsCount > 0) {
+ for (x <- 1 until rel.getFileDataSource.getOptionsCount) {
+ val optionPair = rel.getFileDataSource.getOptions(x)
+ reader.option(optionPair.getOptionKey, optionPair.getOptionValue)
+ }
+ }
+ if (rel.getFileDataSource.getPathList != null) {
Review Comment:
There is no `hasPathList` but I choose to use `getPathCount > 0` to replace
this `null` check.
--
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]