comphead commented on code in PR #9470:
URL: https://github.com/apache/arrow-datafusion/pull/9470#discussion_r1515197737


##########
datafusion/common/src/scalar/mod.rs:
##########
@@ -2225,6 +2225,34 @@ impl ScalarValue {
         }
     }
 
+    pub fn try_from_array_ignore_nulls_first(
+        array: &dyn Array,
+        mut index: usize,
+        ignore_nulls: bool,
+    ) -> Result<Self> {
+        // If ignoring nulls, find the next non-null index.
+        if ignore_nulls {
+            while index < (array.len() - 1) && !array.is_valid(index) {

Review Comment:
   it is probably cheaper to get all null indices first? and then find index in 
the array?
   ```
   array.nulls().unwrap().valid_indices().collect::<Vec<_>>()
   ```
   



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