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-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to