alamb commented on code in PR #14775:
URL: https://github.com/apache/datafusion/pull/14775#discussion_r2078483270


##########
datafusion/ffi/src/arrow_wrappers.rs:
##########
@@ -31,30 +32,37 @@ use log::error;
 #[derive(Debug, StableAbi)]
 pub struct WrappedSchema(#[sabi(unsafe_opaque_field)] pub FFI_ArrowSchema);
 
+/// Some functions are expected to always succeed, like getting the schema 
from a TableProvider.
+/// Since going through the FFI always has the potential to fail, we need to 
catch these errors,
+/// give the user a warning, and return some kind of result. In this case we 
default to an
+/// empty schema.
+#[cfg(not(tarpaulin_include))]

Review Comment:
   What is the alternative suggestion? Is there some way to return an error?



##########
datafusion/core/src/lib.rs:
##########
@@ -843,6 +843,7 @@ pub mod test;
 
 mod schema_equivalence;
 pub mod test_util;
+// pub use test_util::bounded_stream;

Review Comment:
   could remove



##########
datafusion/ffi/src/udaf/groups_accumulator.rs:
##########
@@ -0,0 +1,527 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use std::ffi::c_void;
+
+use abi_stable::{
+    std_types::{ROption, RResult, RString, RVec},
+    StableAbi,
+};
+use arrow::{
+    array::{Array, ArrayRef, BooleanArray},
+    error::ArrowError,
+    ffi::to_ffi,
+};
+use datafusion::{
+    error::{DataFusionError, Result},
+    logical_expr::{EmitTo, GroupsAccumulator},
+};
+
+use crate::{
+    arrow_wrappers::{WrappedArray, WrappedSchema},
+    df_result, rresult, rresult_return,
+};
+
+#[repr(C)]
+#[derive(Debug, StableAbi)]
+#[allow(non_camel_case_types)]
+pub struct FFI_GroupsAccumulator {
+    pub update_batch: unsafe extern "C" fn(
+        accumulator: &mut Self,
+        values: RVec<WrappedArray>,
+        group_indices: RVec<usize>,
+        opt_filter: ROption<WrappedArray>,
+        total_num_groups: usize,
+    ) -> RResult<(), RString>,

Review Comment:
   I would personally suggest not implementing the GroupsAccumulator in the 
first FFI implementation -- it is hard to implement correctly as is. 
   
   Perhaps we can avoid this for now 🤔 
   
   Though I suppose GroupsAccumulator is basically required for high 
performance aggregation 🤔 



##########
datafusion/core/src/datasource/file_format/parquet.rs:
##########
@@ -1661,42 +1661,110 @@ mod tests {
         Ok(())
     }
 
-    /// Creates an bounded stream for testing purposes.
-    fn bounded_stream(
-        batch: RecordBatch,
-        limit: usize,
-    ) -> datafusion_execution::SendableRecordBatchStream {
-        Box::pin(BoundedStream {
-            count: 0,
-            limit,
-            batch,
-        })
-    }
+    #[tokio::test]

Review Comment:
   I don't understand where this test came from as it seems unrelated to the 
rest of the PR



-- 
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: github-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to