Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/12002#discussion_r57747923
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/DefaultSource.scala
---
@@ -91,6 +93,46 @@ class DefaultSource extends FileFormat with
DataSourceRegister {
new CSVOutputWriterFactory(csvOptions)
}
+ override def buildReader(
+ sqlContext: SQLContext,
+ physicalSchema: StructType,
+ partitionSchema: StructType,
+ dataSchema: StructType,
+ filters: Seq[Filter],
+ options: Map[String, String]): (PartitionedFile) =>
Iterator[InternalRow] = {
+ val csvOptions = new CSVOptions(options)
+ val headers = dataSchema.fields.map(_.name)
+
+ val conf = new
Configuration(sqlContext.sparkContext.hadoopConfiguration)
+ val broadcastedConf = sqlContext.sparkContext.broadcast(new
SerializableConfiguration(conf))
+
+ (file: PartitionedFile) => {
+ val lineIterator = {
+ val conf = broadcastedConf.value.value
+ new HadoopFileLinesReader(file, conf).map { line =>
+ new String(line.getBytes, 0, line.getLength, csvOptions.charset)
--- End diff --
is it equal to `line.toString`?
---
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]