You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Michael Armbrust (JIRA)" <ji...@apache.org> on 2016/07/18 18:07:20 UTC

[jira] [Created] (SPARK-16609) Single function for parsing timestamps/dates

Michael Armbrust created SPARK-16609:
----------------------------------------

             Summary: Single function for parsing timestamps/dates
                 Key: SPARK-16609
                 URL: https://issues.apache.org/jira/browse/SPARK-16609
             Project: Spark
          Issue Type: Improvement
          Components: SQL
            Reporter: Michael Armbrust


Today, if you want to parse a date or timestamp, you have to use the unix time function and then cast to a timestamp.  Its a little odd there isn't a single function that does both.  I propose we add

{code}
to_date(<input>, <pattern>)/to_timestamp(<input>, <pattern>).
{code}

For reference, in other systems there are:

MS SQL: {{convert(<input>, <pattern id>)}}. See: https://technet.microsoft.com/en-us/library/ms174450(v=sql.110).aspx
Netezza: {{to_timestamp(<input>, <pattern>)}}. See: https://www.ibm.com/support/knowledgecenter/SSULQD_7.0.3/com.ibm.nz.dbu.doc/r_dbuser_ntz_sql_extns_conversion_funcs.html
Teradata has special casting functionality: {{cast(<input> as timestamp format '<pattern>')}}
MySql: {{STR_TO_DATE(<input>, <pattern>)}}. This returns a datetime when you define both date and time parts. See: https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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