Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Do
-
2.1.2, 2.2.1, 2.3.0
-
None
-
None
Description
This issue aims to fix the following `CAST` behavior on `CHAR/VARCHAR` types.
Since HiveStringType is used only in parsing, this PR is also about parsing.
Spark
scala> sql("SELECT CAST('123' AS CHAR(1)), CAST('123' AS VARCHAR(1))").show +-------------------+-------------------+ |CAST(123 AS STRING)|CAST(123 AS STRING)| +-------------------+-------------------+ | 123| 123| +-------------------+-------------------+ scala> sql("SELECT CAST('123' AS CHAR(0)), CAST('123' AS VARCHAR(0))").show +-------------------+-------------------+ |CAST(123 AS STRING)|CAST(123 AS STRING)| +-------------------+-------------------+ | 123| 123| +-------------------+-------------------+
Hive
hive> SELECT CAST('123' AS CHAR(1)), CAST('123' AS VARCHAR(1)); OK 1 1 hive> SELECT CAST('123' AS CHAR(0)), CAST('123' AS VARCHAR(0)); FAILED: RuntimeException Char length 0 out of allowed range [1, 255]
Attachments
Issue Links
- relates to
-
SPARK-19459 ORC tables cannot be read when they contain char/varchar columns
- Resolved
- links to