You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Liang-Chi Hsieh (JIRA)" <ji...@apache.org> on 2017/11/06 01:58:00 UTC
[jira] [Commented] (SPARK-22442) Schema generated by Product
Encoder doesn't match case class field name when using non-standard
characters
[ https://issues.apache.org/jira/browse/SPARK-22442?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239815#comment-16239815 ]
Liang-Chi Hsieh commented on SPARK-22442:
-----------------------------------------
I tried on latest master branch. It can work with {{as[MyType]}}.
{code}
scala> val df = Seq(MyType("a", "b"), MyType("c", "d")).toDF
df: org.apache.spark.sql.DataFrame = [field$u002E1: string, field$u00202: string]
scala> df.as[MyType].collect
res7: Array[MyType] = Array(MyType(a,b), MyType(c,d))
{code}
> Schema generated by Product Encoder doesn't match case class field name when using non-standard characters
> ----------------------------------------------------------------------------------------------------------
>
> Key: SPARK-22442
> URL: https://issues.apache.org/jira/browse/SPARK-22442
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.0.2, 2.1.2, 2.2.0
> Reporter: Mikel San Vicente
>
> Product encoder encodes special characters wrongly when field name contains certain nonstandard characters.
> For example for:
> {quote}
> case class MyType(`field.1`: String, `field 2`: String)
> {quote}
> we will get the following schema
> {quote}
> root
> |-- field$u002E1: string (nullable = true)
> |-- field$u00202: string (nullable = true)
> {quote}
> As a consequence of this issue a DataFrame with the correct schema can't be converted to a Dataset using .as[MyType]
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org