[ https://issues.apache.org/jira/browse/SPARK-37324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sathiya Kumar updated SPARK-37324: ---------------------------------- Description: Currently we support only Decimal RoundingModes : HALF_UP (round) and HALF_EVEN (bround). But we have use cases that needs RoundingMode.UP and RoundingMode.DOWN. In our projects we use UDF, i also see few people do complex operations to do the same with spark native methods. [https://stackoverflow.com/questions/34888419/round-down-double-in-spark/40476117] [https://stackoverflow.com/questions/54683066/is-there-a-rounddown-function-in-sql-as-there-is-in-excel] [https://stackoverflow.com/questions/48279641/oracle-sql-round-half] Opening support for the other rounding modes might interest a lot of use cases. *SAP Hana Sql ROUND function does it :* {code:java} ROUND(<number> [, <position> [, <rounding_mode>]]){code} REF : [https://help.sap.com/viewer/7c78579ce9b14a669c1f3295b0d8ca16/Cloud/en-US/20e6a27575191014bd54a07fd86c585d.html] *Sql Server does something similar to this* : {code:java} ROUND ( numeric_expression , length [ ,function ] ){code} REF : [https://docs.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql?view=sql-server-ver15] was: Currently we support only Decimal RoundingModes : HALF_UP (round) and HALF_EVEN (bround). But we have use cases that needs RoundingMode.UP and RoundingMode.DOWN. In our projects we use UDF, i also see few people do complex operations to do the same with spark native methods. [https://stackoverflow.com/questions/34888419/round-down-double-in-spark/40476117] [https://stackoverflow.com/questions/54683066/is-there-a-rounddown-function-in-sql-as-there-is-in-excel] [https://stackoverflow.com/questions/48279641/oracle-sql-round-half] Opening support for the other rounding modes might interest a lot of use cases. Sql Server does something similar to this : [https://docs.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql?view=sql-server-ver15] > Support Decimal RoundingMode.UP, DOWN, HALF_DOWN > ------------------------------------------------ > > Key: SPARK-37324 > URL: https://issues.apache.org/jira/browse/SPARK-37324 > Project: Spark > Issue Type: New Feature > Components: SQL > Affects Versions: 3.2.0 > Reporter: Sathiya Kumar > Priority: Minor > > Currently we support only Decimal RoundingModes : HALF_UP (round) and > HALF_EVEN (bround). But we have use cases that needs RoundingMode.UP and > RoundingMode.DOWN. In our projects we use UDF, i also see few people do > complex operations to do the same with spark native methods. > [https://stackoverflow.com/questions/34888419/round-down-double-in-spark/40476117] > [https://stackoverflow.com/questions/54683066/is-there-a-rounddown-function-in-sql-as-there-is-in-excel] > [https://stackoverflow.com/questions/48279641/oracle-sql-round-half] > > Opening support for the other rounding modes might interest a lot of use > cases. > *SAP Hana Sql ROUND function does it :* > {code:java} > ROUND(<number> [, <position> [, <rounding_mode>]]){code} > REF : > [https://help.sap.com/viewer/7c78579ce9b14a669c1f3295b0d8ca16/Cloud/en-US/20e6a27575191014bd54a07fd86c585d.html] > *Sql Server does something similar to this* : > {code:java} > ROUND ( numeric_expression , length [ ,function ] ){code} > REF : > [https://docs.microsoft.com/en-us/sql/t-sql/functions/round-transact-sql?view=sql-server-ver15] > > -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org