korlov42 commented on code in PR #2769:
URL: https://github.com/apache/ignite-3/pull/2769#discussion_r1378636547


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/datatypes/varbinary/ItVarBinaryExpressionTest.java:
##########
@@ -93,6 +93,10 @@ public void testLengthExpressionWithDynamicParameter() {
                 .withParams(new byte[0])
                 .returns(0).check();
 
+        checkQuery("SELECT OCTET_LENGTH(?)")
+                .withParams("123")

Review Comment:
   this test class dedicated to VarBinary type, not VarChar



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/IgniteSqlFunctions.java:
##########
@@ -125,7 +125,12 @@ public static String toString(ByteString b) {
 
     /** LENGTH(VARBINARY|VARCHAR). */
     public static int length(Object b) {
-        return b instanceof ByteString ? octetLength((ByteString) b) : 
charLength((String) b);
+        return b instanceof ByteString ? SqlFunctions.octetLength((ByteString) 
b) : charLength((String) b);
+    }
+
+    /** OCTET_LENGTH(VARBINARY|VARCHAR). */
+    public static int octetLength(Object s) {

Review Comment:
   it's better to have overloaded version for every supported type of parameters



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItFunctionsTest.java:
##########
@@ -68,6 +68,13 @@ public void testLength() {
         assertQuery("SELECT LENGTH(NULL)").returns(NULL_RESULT).check();
     }
 
+    @Test
+    public void testOctetLength() {
+        assertQuery("SELECT OCTET_LENGTH('TEST')").returns(4).check();

Review Comment:
   let's also add different tests for different languages to make sure 
OCTET_LENGTH differs from regular LENGTH



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