You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Alexandre Dupriez (JIRA)" <ji...@apache.org> on 2017/09/04 15:54:00 UTC

[jira] [Comment Edited] (SPARK-17041) Columns in schema are no longer case sensitive when reading csv file

    [ https://issues.apache.org/jira/browse/SPARK-17041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16152745#comment-16152745 ] 

Alexandre Dupriez edited comment on SPARK-17041 at 9/4/17 3:53 PM:
-------------------------------------------------------------------

I would advocate for a message which highlights the problem is case-related, since it may not be obvious from a message like
{{Reference 'Output' is ambiguous, could be: Output#1263, Output#1295}}
In fact it seems the column's header name provided in the message can be taken from either of the colliding columns - and thus contain capital letters, which can be misleading w.r.t. case sensitivity.


was (Author: hangleton):
I would advocate for a message which highlights the problem is case-related, since it may not be obvious from a message like {{Reference 'Output' is ambiguous, could be: Output#1263, Output#1295}}
In fact it seems the column's header name provided in the message can be taken from either of the colliding columns - and thus contain capital letters, which can be misleading w.r.t. case sensitivity.

> Columns in schema are no longer case sensitive when reading csv file
> --------------------------------------------------------------------
>
>                 Key: SPARK-17041
>                 URL: https://issues.apache.org/jira/browse/SPARK-17041
>             Project: Spark
>          Issue Type: Bug
>          Components: Input/Output
>    Affects Versions: 2.0.0
>            Reporter: Barry Becker
>
> It used to be (in spark 1.6.2) that I could read a csv file that had columns with  names that differed only by case. For example, one column may be "output" and another called "Output". Now (with spark 2.0.0) if I try to read such a file, I get an error like this:
> {code}
> org.apache.spark.sql.AnalysisException: Reference 'Output' is ambiguous, could be: Output#1263, Output#1295.;
> {code}
> The schema (dfSchema below) that I pass to the csv read looks like this:
> {code}
> StructType( StructField(Output,StringType,true), ... StructField(output,StringType,true), ...)
> {code}
> The code that does the read is this
> {code}
> sqlContext.read
>           .format("csv")
>           .option("header", "false") // Use first line of all files as header
>           .option("inferSchema", "false") // Automatically infer data types
>           .schema(dfSchema)
>           .csv(dataFile)
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org