Github user marmbrus commented on a diff in the pull request:
https://github.com/apache/spark/pull/11034#discussion_r52060451
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/sources/interfaces.scala ---
@@ -195,6 +196,35 @@ trait HadoopFsRelationProvider {
}
createRelation(sqlContext, paths, dataSchema, partitionColumns,
parameters)
}
+
+ override def createSource(
+ sqlContext: SQLContext,
+ schema: Option[StructType],
+ providerName: String,
+ parameters: Map[String, String]): Source = {
+ val path = parameters("path")
+ val metadataPath = parameters.getOrElse("metadataPath",
s"$path/_metadata")
+
+ def dataFrameBuilder(files: Array[String]): DataFrame = {
+ val relation = createRelation(
+ sqlContext,
+ files,
+ schema,
+ partitionColumns = None,
+ bucketSpec = None,
+ parameters)
+ DataFrame(sqlContext, LogicalRelation(relation))
+ }
+
+ val maybeSchema =
+ if (schema.isEmpty && providerName == "text") {
--- End diff --
My point was that I don't want to special case the logic here, but should
instead defer to the source. What happens if we add another source that is
capable of producing a schema without any files present?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]