nushell/crates/nu_plugin_polars/src/dataframe/command/aggregation/mod.rs
Jack Wright 8d60c0d35d
Migrating polars commands away from macros, removed custom DataFrame comparison. (#13829)
# Description
This PR:
- Removes the lazy_command, expr_command macros and migrates the
commands that were utilizing them.
- Removes the custom logic in DataFrameValues::is_equals to use the
polars DataFrame version of PartialEq
- Adds examples to commands that previously did not have examples or had
inadequate ones.

NOTE: A lot of examples now have a `polars sort` at the end. This is
needed due to the comparison in the result. The new polars version of
equals cares about the ordering. I removed the custom equals logic as it
causes comparisons to lock up when comparing dataframes that contain a
row that contains a list. I discovered this issue when adding examples
to `polars implode`
2024-09-11 10:33:05 -07:00

61 lines
1.3 KiB
Rust

mod agg_groups;
mod aggregate;
mod count;
mod cumulative;
pub mod groupby;
mod implode;
mod max;
mod mean;
mod median;
mod min;
mod n_null;
mod n_unique;
mod quantile;
mod rolling;
mod std;
mod sum;
mod value_counts;
mod var;
use crate::PolarsPlugin;
use agg_groups::ExprAggGroups;
use nu_plugin::PluginCommand;
pub use aggregate::LazyAggregate;
use count::ExprCount;
pub use cumulative::Cumulative;
use implode::ExprImplode;
use max::ExprMax;
use mean::ExprMean;
use min::ExprMin;
pub use n_null::NNull;
pub use n_unique::NUnique;
pub use rolling::Rolling;
use std::ExprStd;
pub use sum::ExprSum;
pub use value_counts::ValueCount;
use var::ExprVar;
pub(crate) fn aggregation_commands() -> Vec<Box<dyn PluginCommand<Plugin = PolarsPlugin>>> {
vec![
Box::new(Cumulative),
Box::new(ExprAggGroups),
Box::new(ExprCount),
Box::new(ExprImplode),
Box::new(ExprMax),
Box::new(ExprMin),
Box::new(ExprSum),
Box::new(ExprMean),
Box::new(ExprStd),
Box::new(ExprVar),
Box::new(LazyAggregate),
Box::new(median::LazyMedian),
Box::new(quantile::LazyQuantile),
Box::new(groupby::ToLazyGroupBy),
Box::new(Rolling),
Box::new(ValueCount),
Box::new(NNull),
Box::new(NUnique),
]
}