[ 
https://issues.apache.org/jira/browse/SPARK-43815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Richard Yu updated SPARK-43815:
-------------------------------
    Description: 
We want to add support for the follow functions:
 * to_varchar() as an alias for to_char()

 * Expand to_char() to take date, timestamp and binary expression as the first 
argument. For date and timestamp expression, the function will be equivalent to 
date_format(expr, fmt) . For binary expression, the function will be equivalent 
to base64() , hex(), and decode(<expr>, 'UTF-8') for fmt base64, hex, and UTF-8 
respectively.

 * timediff() as an alias for timestampdiff()

  was:
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```.


> 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
>            Priority: Major
>
> We want to add support for the follow functions:
>  * to_varchar() as an alias for to_char()
>  * Expand to_char() to take date, timestamp and binary expression as the 
> first argument. For date and timestamp expression, the function will be 
> equivalent to date_format(expr, fmt) . For binary expression, the function 
> will be equivalent to base64() , hex(), and decode(<expr>, 'UTF-8') for fmt 
> base64, hex, and UTF-8 respectively.
>  * timediff() as an alias for timestampdiff()



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

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

Reply via email to