You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Takeshi Yamamuro (Jira)" <ji...@apache.org> on 2019/12/29 06:31:00 UTC

[jira] [Updated] (SPARK-28298) Fully support char and varchar types

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

Takeshi Yamamuro updated SPARK-28298:
-------------------------------------
    Parent Issue: SPARK-30375  (was: SPARK-27764)

> Fully support char and varchar types
> ------------------------------------
>
>                 Key: SPARK-28298
>                 URL: https://issues.apache.org/jira/browse/SPARK-28298
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Zhu, Lipeng
>            Priority: Major
>
> Execute below SQL in Spark, the result is "abcdef".   But the result of other DBMS is "abc"(I think this is more sensible).
> {code:sql}
> select cast("abcdef" as char(3));
> {code}
> And then I checked the source code, seems char/varchar only be used in DDL parse.
> {code:java}
> /**
>  * Hive char type. Similar to other HiveStringType's, these datatypes should only used for
>  * parsing, and should NOT be used anywhere else. Any instance of these data types should be
>  * replaced by a [[StringType]] before analysis.
>  */
> case class CharType(length: Int) extends HiveStringType {
>   override def simpleString: String = s"char($length)"
> }
> /**
>  * Hive varchar type. Similar to other HiveStringType's, these datatypes should only used for
>  * parsing, and should NOT be used anywhere else. Any instance of these data types should be
>  * replaced by a [[StringType]] before analysis.
>  */
> case class VarcharType(length: Int) extends HiveStringType {
>   override def simpleString: String = s"varchar($length)"
> }
> {code}
> Is this behavior expected? 



--
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