beliefer opened a new pull request #31448: URL: https://github.com/apache/spark/pull/31448
### What changes were proposed in this pull request? `Postgresql` and `Oracle` have the function `to_number` to convert a string to number. The implement and support syntax has many different between `Postgresql` and `Oracle`. So, this PR mainly follows the implement of `to_number` in `Postgresql`. There are some mainstream database support the syntax. **PostgreSQL:** https://www.postgresql.org/docs/12/functions-formatting.html **Oracle:** https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/TO_NUMBER.html#GUID-D4807212-AFD7-48A7-9AED-BEC3E8809866 **Vertica** https://www.vertica.com/docs/10.0.x/HTML/Content/Authoring/SQLReferenceManual/Functions/Formatting/TO_NUMBER.htm?tocpath=SQL%20Reference%20Manual%7CSQL%20Functions%7CFormatting%20Functions%7C_____7 **Redshift** https://docs.aws.amazon.com/redshift/latest/dg/r_TO_NUMBER.html **DB2** https://www.ibm.com/support/knowledgecenter/SSGU8G_14.1.0/com.ibm.sqls.doc/ids_sqs_1544.htm **Teradata** https://docs.teradata.com/r/kmuOwjp1zEYg98JsB8fu_A/TH2cDXBn6tala29S536nqg **Snowflake:** https://docs.snowflake.net/manuals/sql-reference/functions/to_decimal.html **Exasol** https://docs.exasol.com/sql_references/functions/alphabeticallistfunctions/to_number.htm#TO_NUMBER **Singlestore** https://docs.singlestore.com/v7.3/reference/sql-reference/numeric-functions/to-number/ **Intersystems** https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_TONUMBER The syntax like: > select to_number('12,454.8-', '99G999D9S'); -12454.8 ### Why are the changes needed? This PR adds a new function. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? New UT. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
