Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/20894#discussion_r188547437
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/CSVDataSource.scala
---
@@ -118,16 +122,62 @@ object CSVDataSource {
TextInputCSVDataSource
}
}
+
+ def checkHeaderColumnNames(schema: StructType, columnNames:
Array[String], fileName: String,
+ checkHeaderFlag: Boolean, caseSensitive: Boolean): Unit = {
+ if (checkHeaderFlag && columnNames != null) {
+ val fieldNames = schema.map(_.name).toIndexedSeq
+ val (headerLen, schemaSize) = (columnNames.size, fieldNames.length)
+ var error: Option[String] = None
+
+ if (headerLen == schemaSize) {
+ var i = 0
+ while (error.isEmpty && i < headerLen) {
+ var (nameInSchema, nameInHeader) = (fieldNames(i),
columnNames(i))
+ if (caseSensitive == false) {
--- End diff --
bool comparison.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]