tanclary commented on code in PR #3233:
URL: https://github.com/apache/calcite/pull/3233#discussion_r1210376844


##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -3869,6 +3869,17 @@ private static AtomicLong getAtomicLong(String key) {
     return atomic;
   }
 
+  /** Support the ARRAY_COMPACT function. */
+  public static List removeNulls(List list) {
+    List result = new ArrayList();
+    for (int i = 0; i < list.size(); i++) {
+      if (list.get(i) != null) {
+        result.add(list.get(i));
+      }
+    }
+    return result;
+  }
+
   /** Support the ARRAY_DISTINCT function. */

Review Comment:
   Is there a reason to iterate by index rather than something like `for(Object 
obj : list)` ? Could help with readability a bit. Just an idea.



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