[ https://issues.apache.org/jira/browse/SPARK-43815?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Richard Yu updated SPARK-43815: ------------------------------- Description: Today, users who have SQL engines which support \{code:java} to_varchar \{code} 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```. 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 > > Today, users who have SQL engines which support \{code:java} to_varchar > \{code} 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org