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

Maxim Gekk updated SPARK-24571:
-------------------------------
    Description: 
Currently, Spark doesn't support literals with the Char (java.lang.Character) 
type. For example, the following code throws an exception:
{code}
val df = Seq("Amsterdam", "San Francisco", "London").toDF("city")
df.where($"city".contains('o')).show(false)
{code}
It fails with the exception:
{code:java}
Unsupported literal type class java.lang.Character o
java.lang.RuntimeException: Unsupported literal type class java.lang.Character o
at org.apache.spark.sql.catalyst.expressions.Literal$.apply(literals.scala:78)
{code}
One of the possible solutions can be automatic conversion of Char literal to 
String literal of length 1.

  was:
Currently, Spark doesn't support literals with the Char (java.lang.Character) 
type. For example, the following code throws an exception:
{code:scala}
val df = Seq("Amsterdam", "San Francisco", "London").toDF("city")
df.where($"city".contains('o')).show(false)
{code}
It fails with the exception:
{code}
Unsupported literal type class java.lang.Character o
java.lang.RuntimeException: Unsupported literal type class java.lang.Character p
at org.apache.spark.sql.catalyst.expressions.Literal$.apply(literals.scala:78)
{code}
One of the possible solutions can be automatic conversion of Char literal to 
String literal of length 1.


> Support literals with values of the Char type
> ---------------------------------------------
>
>                 Key: SPARK-24571
>                 URL: https://issues.apache.org/jira/browse/SPARK-24571
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.3.1
>            Reporter: Maxim Gekk
>            Priority: Minor
>
> Currently, Spark doesn't support literals with the Char (java.lang.Character) 
> type. For example, the following code throws an exception:
> {code}
> val df = Seq("Amsterdam", "San Francisco", "London").toDF("city")
> df.where($"city".contains('o')).show(false)
> {code}
> It fails with the exception:
> {code:java}
> Unsupported literal type class java.lang.Character o
> java.lang.RuntimeException: Unsupported literal type class 
> java.lang.Character o
> at org.apache.spark.sql.catalyst.expressions.Literal$.apply(literals.scala:78)
> {code}
> One of the possible solutions can be automatic conversion of Char literal to 
> String literal of length 1.



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

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

Reply via email to