hsyuan commented on a change in pull request #1150: [CALCITE-2985] Add the 
JSON_STORAGE_SIZE function
URL: https://github.com/apache/calcite/pull/1150#discussion_r275166879
 
 

 ##########
 File path: 
core/src/test/java/org/apache/calcite/sql/test/SqlOperatorBaseTest.java
 ##########
 @@ -4491,6 +4491,21 @@ private void checkNullOperand(SqlTester tester, String 
op) {
         "null", "VARCHAR(2000) NOT NULL");
   }
 
+  @Test public void testJsonStorageSize() {
+    tester.checkString("json_storage_size('[100, \"sakila\", [1, 3, 5], 
425.05]')",
+            "29", "INTEGER");
+    tester.checkString("json_storage_size('{\"a\": 1000, \"b\": \"a\", \"c\": 
\"[1, 3, 5, 7]\"}')",
+            "37", "INTEGER");
+    tester.checkString("json_storage_size('{\"a\": 1000, \"b\": \"wxyz\", 
\"c\": \"[1, 3]\"}')",
+            "34", "INTEGER");
+    tester.checkString("json_storage_size('[100, \"json\", [[10, 20, 30], 3, 
5], 425.05]')",
+            "36", "INTEGER");
+    tester.checkString("json_storage_size('null')",
+            null, "INTEGER");
 
 Review comment:
   Can you explain this one? 'null' is a string, why does it return null? Is 
there case for ` It returns NULL if the argument is NULL.`?

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


With regards,
Apache Git Services

Reply via email to