[jira] [Commented] (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 commented on SPARK-17041: --- 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15443779#comment-15443779 ] koert kuipers commented on SPARK-17041: --- note that the docs say: "It is highly discouraged to turn on case sensitive mode." which seems to suggest one shouldn't have files like this. that is not very realistic. i feel like this is a case where a bad idea (sql lack of case sensitivity) is being pushed upon us. if only we could ignore the bad sql ideas a bit more and be inspired by R data.frame or pandas. > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15420994#comment-15420994 ] Dongjoon Hyun commented on SPARK-17041: --- Great! Thank you for confirming. > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15420952#comment-15420952 ] Barry Becker commented on SPARK-17041: -- Yes, that suggestion worked. I added {code} sqlContext.sql("set spark.sql.caseSensitive=true") {code} Right before the read and I can now read the file with columns that only differ by case. I would prefer that that be the default behavior, but at least this is no longer a block for me. Thanks! > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15420106#comment-15420106 ] Dongjoon Hyun commented on SPARK-17041: --- Since I don't have the exact script of your situation, it might be different. But, Spark 2.0 supports `case sensitive` of course with SQL configuration. In the above, `sql("set spark.sql.caseSensitive=true")`. Could you confirm on your site, [~barrybecker4]? > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15420105#comment-15420105 ] Dongjoon Hyun commented on SPARK-17041: --- Hi, [~barrybecker4] I reproduced your problems and I think I can give you the solution. {code} scala> spark.read.format("csv").option("header", "false").option("inferSchema", "false").schema(StructType(Seq(StructField("c", StringType, false), StructField("C", StringType, false.csv("/tmp/csv_caseSensitive").show org.apache.spark.sql.AnalysisException: Reference 'c' is ambiguous, could be: c#45, c#46.; ... scala> sql("set spark.sql.caseSensitive=true") res9: org.apache.spark.sql.DataFrame = [key: string, value: string] scala> spark.read.format("csv").option("header", "false").option("inferSchema", "false").schema(StructType(Seq(StructField("c", StringType, false), StructField("C", StringType, false.csv("/tmp/csv_caseSensitive").show +---+---+ | c| C| +---+---+ | c1| C1| | 1| 2| +---+---+ {code} > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15420100#comment-15420100 ] Dongjoon Hyun commented on SPARK-17041: --- Hi, [~barrybecker4]. Could you give us more reproducible example? > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15419158#comment-15419158 ] Barry Becker commented on SPARK-17041: -- I'm not sure either. How can we find out? I think it would be better if columns were case sensitive. Was the change intentional? This was a dataset from a client, and for whatever reason, they thought it was reasonable to have columns that varied only by case. Since it was something that worked before, I thought it might be considered a regression, but maybe it should be a feature request. In our product, someone may rename a column from "output" to "Output". If the column names are not case sensitive, I'm not sure what problems this might cause. At a minimum, the rename will probably not work. > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org
[jira] [Commented] (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=15419133#comment-15419133 ] Sean Owen commented on SPARK-17041: --- Behavior changes across major versions. I'm not sure this is a bug just because behavior is different. > 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.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org