pub fn batch_filter(
    batch: &RecordBatch,
    predicate: &Arc<dyn PhysicalExpr>,
) -> ArrowResult<RecordBatch> {
    predicate
        .evaluate(batch)
        .map(|v| v.into_array(batch.num_rows()))
        .map_err(DataFusionError::into)
        .and_then(|array| {
            array
                .as_any()
                .downcast_ref::<BooleanArray>()
                .ok_or_else(|| {
                    DataFusionError::Internal(
                        "Filter predicate evaluated to non-boolean value".to_string(),
                    )
                    .into()
                })
                // apply filter array to record batch
                .and_then(|filter_array| filter_record_batch(batch, filter_array))
        })
}
/// Filter data from RecordBatch
///
/// Borrowed from DF's <https://github.com/apache/arrow-datafusion/blob/ecd0081bde98e9031b81aa6e9ae2a4f309fcec12/datafusion/src/physical_plan/filter.rs#L186>.
// TODO: if we make DF batch_filter public, we can call that function directly
Filter data from RecordBatch
Borrowed from DF's .
TODO: if we make DF batch_filter public, we can call that function directly
Filter data from RecordBatch Borrowed from DF ' s . TODO : if we make DF batch_filter public we can call that function directly
pub fn batch_filter(
    batch: &RecordBatch,
    predicate: &Arc<dyn PhysicalExpr>,
) -> ArrowResult<RecordBatch> {
    predicate
        .evaluate(batch)
        .map(|v| v.into_array(batch.num_rows()))
        .map_err(DataFusionError::into)
        .and_then(|array| {
            array
                .as_any()
                .downcast_ref::<BooleanArray>()
                .ok_or_else(|| {
                    DataFusionError::Internal(
                        "Filter predicate evaluated to non-boolean value".to_string(),
                    )
                    .into()
                })
                // apply filter array to record batch
                .and_then(|filter_array| filter_record_batch(batch, filter_array))
        })
}
pub fn batch_filter ( batch : & RecordBatch , predicate : & Arc < dyn PhysicalExpr > , ) -> ArrowResult < RecordBatch > { predicate . evaluate ( batch ) . map ( | v | v . into_array ( batch . num_rows ( ) ) ) . map_err ( DataFusionError :: into ) . and_then ( | array | { array . as_any ( ) . downcast_ref :: < BooleanArray > ( ) . ok_or_else ( | | { DataFusionError :: Internal ( " " . to_string ( ) , ) . into ( ) } ) // apply filter array to record batch . and_then ( | filter_array | filter_record_batch ( batch , filter_array ) ) } ) }
Filter data from RecordBatch
Borrowed from DF's <https://github.com/apache/arrow-datafusion/blob/ecd0081bde98e9031b81aa6e9ae2a4f309fcec12/datafusion/src/physical_plan/filter.rs#L186>.
Filter data from RecordBatch Borrowed from DF ' s <https : // github . com / apache / arrow - datafusion / blob / ecd0081bde98e9031b81aa6e9ae2a4f309fcec12 / datafusion / src / physical_plan / filter . rs#L186 > .
batch
&RecordBatch
predicate
&Arc<dyn PhysicalExpr>
batch
&RecordBatch
predicate
&Arc<dyn PhysicalExpr>