Github user xguo27 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10515#discussion_r48788553
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/DefaultSource.scala
 ---
    @@ -70,15 +70,16 @@ class DefaultSource extends HadoopFsRelationProvider 
with DataSourceRegister {
     
     private[sql] class TextRelation(
         val maybePartitionSpec: Option[PartitionSpec],
    +    val textSchema: Option[StructType],
         override val userDefinedPartitionColumns: Option[StructType],
         override val paths: Array[String] = Array.empty[String],
         parameters: Map[String, String] = Map.empty[String, String])
         (@transient val sqlContext: SQLContext)
       extends HadoopFsRelation(maybePartitionSpec, parameters) {
     
    -  /** Data schema is always a single column, named "value". */
    -  override def dataSchema: StructType = new StructType().add("value", 
StringType)
    -
    +  /** Data schema is always a single column, named "value" if original 
Data source has no schema. */
    +  override def dataSchema: StructType =
    +    textSchema.getOrElse(new StructType().add("value", StringType))
    --- End diff --
    
    @cloud-fan DefaultSource.scala is the only place that creates a 
TextRelation, and it verifies that the schema is size 1 and of type string 
before creating a TextRelation. So I think it is fine not to verify again here. 
What do you think?


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

Reply via email to