You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Richard Yu (Jira)" <ji...@apache.org> on 2023/05/26 15:45:00 UTC

[jira] [Created] (SPARK-43815) Add SQL functions to_varchar and extend to_char functionality

Richard Yu created SPARK-43815:
----------------------------------

             Summary: Add SQL functions to_varchar and extend to_char functionality
                 Key: SPARK-43815
                 URL: https://issues.apache.org/jira/browse/SPARK-43815
             Project: Spark
          Issue Type: New Feature
          Components: SQL
    Affects Versions: 3.4.1
            Reporter: Richard Yu


Today, users who have SQL engines which support ```to_varchar```  needs to change such function invocations to ```to_char``` when migrating to Apache Spark. To help minimize the amount of changes which users need to make, we introduce a ```to_varchar``` function alias for ```to_char```. Additionally, we extend ```to_char()``` such that when the first argument of the function is:
 * date or timestamp: ```to_char``` is equivalent to ```date_format(expr, format)```
 * base64: equivalent to ```base64()```
 * hex: equivalent to ```hex()```
 * UTF-8: equivalent to ```decode(<expr>, 'UTF-8')```

Additioally, we add support for the ```timediff``` alias for ```timestampdiff```.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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