vladErmakov07 commented on a change in pull request #9199:
URL: https://github.com/apache/ignite/pull/9199#discussion_r659792011



##########
File path: 
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctions.java
##########
@@ -53,6 +59,46 @@ public static ScannableTable systemRange(Object rangeStart, 
Object rangeEnd, Obj
         return new RangeTable(rangeStart, rangeEnd, increment);
     }
 
+    /** CAST(DECIMAL AS VARCHAR). */
+    public static String toString(BigDecimal x) {
+        return x.toPlainString();
+    }
+
+    /** CAST(VARCHAR AS DECIMAL). */
+    public static BigDecimal toBigDecimal(String s, int precision, int scale) {
+        BigDecimal decimal = new BigDecimal(s.trim());
+        return precision == PRECISION_NOT_SPECIFIED ? decimal : 
decimal.setScale(scale, RoundingMode.HALF_UP);
+    }
+
+    /** CAST(FLOAT AS DECIMAL). */
+    public static BigDecimal toBigDecimal(float val, int precision, int scale) 
{
+        BigDecimal decimal = new BigDecimal(String.valueOf(val));
+        return precision == PRECISION_NOT_SPECIFIED ? decimal : 
decimal.setScale(scale, RoundingMode.HALF_UP);
+    }
+
+    /** CAST(DOUBLE AS DECIMAL). */
+    public static BigDecimal toBigDecimal(double val, int precision, int 
scale) {
+        BigDecimal decimal = BigDecimal.valueOf(val);
+        return precision == PRECISION_NOT_SPECIFIED ? decimal : 
decimal.setScale(scale, RoundingMode.HALF_UP);
+    }
+
+    /** CAST(REAL AS DECIMAL). */

Review comment:
       Renamed to FLOAT




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to