GitHub user WeichenXu123 opened a pull request: https://github.com/apache/spark/pull/12987
[spark-15212][SQL]CSV file reader when read file with first line schema do not filter blank in schema column name ## What changes were proposed in this pull request? When load csv file with schema, add schema column name string trim to avoid blank problem. ## How was this patch tested? construct csv data file contains schema definition with column blank such as: csv data file containsï¼ ---------------------------------------------------------- col1, col2,col3,col4,col5 1997,Ford,E350,"ac, abs, moon",3000.00 .... ------------------------------------------------------------ notice there is a blank before col2, test command: val sqlContext = new org.apache.spark.sql.SQLContext(sc); var reader = sqlContext.read reader.option("header", true) var df = reader.csv("path/to/csvfile") df.select("col2");//check if OK df.registerTempTable("tab1"); sqlContext.sql("select col2 from tab1"); //check if OK. You can merge this pull request into a Git repository by running: $ git pull https://github.com/WeichenXu123/spark bugfix-15212 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/12987.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #12987 ---- commit 56cc34f37c712d172df6fbc27b2823a571160cda Author: WeichenXu <weichenxu...@outlook.com> Date: 2016-05-08T12:52:09Z fix bug: spark-15212 ---- --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org