You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Kent Yao (Jira)" <ji...@apache.org> on 2019/11/14 11:38:00 UTC

[jira] [Created] (SPARK-29895) Extend typed literals support for all spark native types

Kent Yao created SPARK-29895:
--------------------------------

             Summary: Extend typed literals support for all spark native types
                 Key: SPARK-29895
                 URL: https://issues.apache.org/jira/browse/SPARK-29895
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: Kent Yao


Currently, Date, Timestamp, Interval, Binary, and INTEGER typed literals are supported.

We should support other native datatypes for this feature.
{code:sql}
+-- typed literals
+-- boolean
+select boolean 'true';
+select boolean 'false';
+select boolean 't';
+select boolean 'f';
+select boolean 'yes';
+select boolean 'no';
+select -boolean 'true';
+
+-- byte
+select tinyint '1';
+select tinyint '-1';
+select tinyint '128';
+select byte '1';
+select -tinyint '1';
+
+-- short
+select smallint '1';
+select smallint '-1';
+select smallint '32768';
+select short '1';
+select -smallint '1';
+
+-- long
+select long '1';
+select bigint '-1';
+select -bigint '1';
+
+-- float/double
+select float '1';
+select -float '-1';
+select double '1';
+select -double '1';
+
+-- hive string type
+select char(10) '12345';
+select varchar(10) '12345';
+
+-- binary
+select binary '12345';
+
+-- decimal
+select decimal '1.000001';
+select decimal(10, 2) '11.1';
+select decimal(2, 0) '11.1';
+select decimal(2, 1) '11.1';
{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