You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "K Jaya Shankar Reddy (Jira)" <ji...@apache.org> on 2020/05/17 08:58:00 UTC
[jira] [Commented] (SPARK-17878) Support for multiple null values
when reading CSV data
[ https://issues.apache.org/jira/browse/SPARK-17878?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17109399#comment-17109399 ]
K Jaya Shankar Reddy commented on SPARK-17878:
----------------------------------------------
[~hyukjin.kwon] Is this resolved? I am in spark 2.3.2 and tried using
{code:java}
spark.read.option("nullValue1", "abc").option("nullValue2", "def").csv("1.csv") -> This isn't doing anything {code}
and
{code:java}
spark.read.option("nullValue", Seq("abc","def")).csv("1.csv") -> And this throws error saying
error: overloaded method value option with alternatives: (key: String,value: Double)org.apache.spark.sql.DataFrameReader <and> (key: String,value: Long)org.apache.spark.sql.DataFrameReader <and> (key: String,value: Boolean)org.apache.spark.sql.DataFrameReader <and> (key: String,value: String)org.apache.spark.sql.DataFrameReader cannot be applied to (String, Seq[String]){code}
Can someone please help with the right syntax?
> Support for multiple null values when reading CSV data
> ------------------------------------------------------
>
> Key: SPARK-17878
> URL: https://issues.apache.org/jira/browse/SPARK-17878
> Project: Spark
> Issue Type: Story
> Components: SQL
> Affects Versions: 2.0.1
> Reporter: Hossein Falaki
> Priority: Major
> Labels: bulk-closed
>
> There are CSV files out there with multiple values that are supposed to be interpreted as null. As a result, multiple spark users have asked for this feature built into the CSV data source. It can be easily implemented in a backwards compatible way:
> - Currently CSV data source supports an option named {{nullValue}}.
> - We can add logic in {{CSVOptions}} to understands option names that match {{nullValue[\d]}}. This way user can specify a query with multiple or one null value.
> {code}
> val df = spark.read.format("CSV").option("nullValue1", "-").option("nullValue2", "*")....
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org