You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Maxim Gekk (JIRA)" <ji...@apache.org> on 2018/10/06 10:04:00 UTC

[jira] [Updated] (SPARK-25660) Impossible to use backward slash as the CSV fields delimiter

     [ https://issues.apache.org/jira/browse/SPARK-25660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maxim Gekk updated SPARK-25660:
-------------------------------
    Issue Type: Bug  (was: Improvement)

> Impossible to use backward slash as the CSV fields delimiter 
> -------------------------------------------------------------
>
>                 Key: SPARK-25660
>                 URL: https://issues.apache.org/jira/browse/SPARK-25660
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.0
>            Reporter: Maxim Gekk
>            Priority: Minor
>
> If fields in CSV input are delimited by *'\'*, for example:
> {code}
> 123\4\5\1\Q\\P\P\2321213\1\\\P\\F
> {code}
> reading it by the code:
> {code:python}
> df = spark.read.format('csv').option("header","false").options(delimiter='\\').load("file:///file.csv")
> {code}
> causes the exception:
> {code}
> String index out of range: 1
> java.lang.StringIndexOutOfBoundsException: String index out of range: 1
> 	at java.lang.String.charAt(String.java:658)
> 	at org.apache.spark.sql.execution.datasources.csv.CSVUtils$.toChar(CSVUtils.scala:101)
> 	at org.apache.spark.sql.execution.datasources.csv.CSVOptions.<init>(CSVOptions.scala:86)
> 	at org.apache.spark.sql.execution.datasources.csv.CSVOptions.<init>(CSVOptions.scala:41)
> 	at org.apache.spark.sql.DataFrameReader.csv(DataFrameReader.scala:488)
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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