lowka commented on code in PR #6274:
URL: https://github.com/apache/ignite-3/pull/6274#discussion_r2236404249


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java:
##########
@@ -362,8 +363,33 @@ public static BigDecimal toBigDecimal(Number value, int 
precision, int scale) {
         }
     }
 
+    /** Adjusts precision of {@link SqlTypeName#TIME} value. */
+    public static @Nullable Integer toTimeExact(@Nullable Object object, int 
precision) {
+        if (object == null) {
+            return null;
+        }
+
+        assert object instanceof Integer : object.getClass();
+
+        return toTimeExact((int) object, precision);

Review Comment:
   >i see that we can avoid unboxing here, isn`t it ?
   Untyped variants of `toTimeExact` are used to for dynamic parameters, and 
types of dynamic parameters are always nullable.
   So, no you can not avoid boxing here. see See RexToLitTranslator 
visitDynamicParam. Code to retrieve dynamic parameter `N` looks like this:
   ```
   Object value = ctx.get("?N");
   ```
   



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java:
##########
@@ -362,8 +363,33 @@ public static BigDecimal toBigDecimal(Number value, int 
precision, int scale) {
         }
     }
 
+    /** Adjusts precision of {@link SqlTypeName#TIME} value. */
+    public static @Nullable Integer toTimeExact(@Nullable Object object, int 
precision) {
+        if (object == null) {
+            return null;
+        }
+
+        assert object instanceof Integer : object.getClass();
+
+        return toTimeExact((int) object, precision);

Review Comment:
   >i see that we can avoid unboxing here, isn`t it ?
   
   Untyped variants of `toTimeExact` are used to for dynamic parameters, and 
types of dynamic parameters are always nullable.
   So, no you can not avoid boxing here. see See RexToLitTranslator 
visitDynamicParam. Code to retrieve dynamic parameter `N` looks like this:
   ```
   Object value = ctx.get("?N");
   ```
   



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to