Skip to content

Commit

Permalink
Add filter example (#3014)
Browse files Browse the repository at this point in the history
  • Loading branch information
tustvold authored Nov 4, 2022
1 parent 766f69f commit 282e7b4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions arrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,20 @@
//! * [`sort`](compute::kernels::sort::sort)
//! * some string operators such as [`substring`](compute::kernels::substring::substring) and [`length`](compute::kernels::length::length)
//!
//! ```
//! # use arrow::compute::gt_scalar;
//! # use arrow_array::cast::as_primitive_array;
//! # use arrow_array::Int32Array;
//! # use arrow_array::types::Int32Type;
//! # use arrow_select::filter::filter;
//! let array = Int32Array::from_iter(0..100);
//! let predicate = gt_scalar(&array, 60).unwrap();
//! let filtered = filter(&array, &predicate).unwrap();
//!
//! let expected = Int32Array::from_iter(61..100);
//! assert_eq!(&expected, as_primitive_array::<Int32Type>(&filtered));
//! ```
//!
//! As well as some horizontal operations, such as:
//!
//! * [`min`](compute::kernels::aggregate::min) and [`max`](compute::kernels::aggregate::max)
Expand Down

0 comments on commit 282e7b4

Please sign in to comment.