Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/13041#discussion_r62792044
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/DefaultSource.scala
---
@@ -61,7 +61,9 @@ class DefaultSource extends FileFormat with
DataSourceRegister {
val firstRow = new LineCsvReader(csvOptions).parseLine(firstLine)
val header = if (csvOptions.headerFlag) {
- firstRow
+ firstRow.zipWithIndex.map { case (value, index) =>
+ if (value == "" || value == null) s"C$index" else value
--- End diff --
I see Spark allows a empty string as a field. So, I wonder if we should
rename this with the index and prefix, `C`. Also, I think `""` will throw an
NPE whereas empty string without quotes will produce a correct field because
the default of `nullValue` is `""`.
---
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]