-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-12562][SQL] DataFrame.write.format(text) requires the column name to be called value #10515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
…ame to be called value
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ class DefaultSource extends HadoopFsRelationProvider with DataSourceRegister { | |
| partitionColumns: Option[StructType], | ||
| parameters: Map[String, String]): HadoopFsRelation = { | ||
| dataSchema.foreach(verifySchema) | ||
| new TextRelation(None, partitionColumns, paths)(sqlContext) | ||
| new TextRelation(None, dataSchema, partitionColumns, paths)(sqlContext) | ||
| } | ||
|
|
||
| override def shortName(): String = "text" | ||
|
|
@@ -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) | ||
|
|
||
| override def dataSchema: StructType = | ||
| textSchema.getOrElse(new StructType().add("value", StringType)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we make sure that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @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?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, then it's fine |
||
| /** This is an internal data source that outputs internal row format. */ | ||
| override val needConversion: Boolean = false | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should be updated too.