You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (Jira)" <ji...@apache.org> on 2022/07/17 05:57:00 UTC
[jira] [Updated] (SPARK-38955) Disable lineSep option in 'from_csv' and 'schema_of_csv'
[ https://issues.apache.org/jira/browse/SPARK-38955?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dongjoon Hyun updated SPARK-38955:
----------------------------------
Labels: correctness (was: )
> Disable lineSep option in 'from_csv' and 'schema_of_csv'
> --------------------------------------------------------
>
> Key: SPARK-38955
> URL: https://issues.apache.org/jira/browse/SPARK-38955
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.2.0
> Reporter: Robert Joseph Evans
> Assignee: Hyukjin Kwon
> Priority: Blocker
> Labels: correctness
> Fix For: 3.3.0, 3.2.2
>
>
> I don't know how critical this is. I was doing some general testing to understand {{from_csv}} and found that if I happen to have a {{lineSep}} in the input data and I noticed that the next row appears to be corrupted. {{multiLine}} does not appear to fix it. Because this is data corruption I am inclined to mark this as CRITICAL or BLOCKER, but it is an odd corner case so I m not going to set it myself.
> {code}
> Seq[String]("1,\n2,3,4,5","6,7,8,9,10", "11,12,13,14,15", null).toDF.select(col("value"), from_csv(col("value"), StructType(Seq(StructField("a", LongType), StructField("b", StringType))), Map[String,String]())).show()
> +--------------+---------------+
> | value|from_csv(value)|
> +--------------+---------------+
> | 1,\n2,3,4,5| {1, null}|
> | 6,7,8,9,10| {null, 8}|
> |11,12,13,14,15| {11, 12}|
> | null| null|
> +--------------+---------------+
> {code}
> {code}
> Seq[String]("1,:2,3,4,5","6,7,8,9,10", "11,12,13,14,15", null).toDF.select(col("value"), from_csv(col("value"), StructType(Seq(StructField("a", LongType), StructField("b", StringType))), Map[String,String]("lineSep" -> ":"))).show()
> +--------------+---------------+
> | value|from_csv(value)|
> +--------------+---------------+
> | 1,:2,3,4,5| {1, null}|
> | 6,7,8,9,10| {null, 8}|
> |11,12,13,14,15| {11, 12}|
> | null| null|
> +--------------+---------------+
> {code}
> {code}
> Seq[String]("1,\n2,3,4,5","6,7,8,9,10", "11,12,13,14,15", null).toDF.select(col("value"), from_csv(col("value"), StructType(Seq(StructField("a", LongType), StructField("b", StringType))), Map[String,String]("lineSep" -> ":"))).show()
> +--------------+---------------+
> | value|from_csv(value)|
> +--------------+---------------+
> | 1,\n2,3,4,5| {1, \n2}|
> | 6,7,8,9,10| {6, 7}|
> |11,12,13,14,15| {11, 12}|
> | null| null|
> +--------------+---------------+
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org