Skip to content

Commit

Permalink
updated readme.md with kurtosis example
Browse files Browse the repository at this point in the history
  • Loading branch information
jatin committed Sep 26, 2024
1 parent 32bb384 commit 1342ef9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,20 @@ SELECT min_by(x, y) FROM VALUES (1, 10), (2, 5), (3, 15), (4, 8) as tab(x, y);
-- | 2 |
-- +---------------------+

-- Get the kurtosis value of a column of numeric data.
SELECT kurtosis(col) FROM VALUES (1.0), (10.0), (100.0), (10.0), (1.0) as tab(col);
-- Results in
- +-------------------+
- "| kurtosis(tab.col) |"
- +-------------------+
- "| 4.777292927667962 |"
- +-------------------+

```

## Done

- [x] `mode(expression) -> scalar` - Returns the most frequent (mode) value from a column of data.
- [x] `max_by(expression1, expression2) -> scalar` - Returns the value of `expression1` associated with the maximum value of `expression2`.
- [x] `min_by(expression1, expression2) -> scalar` - Returns the value of `expression1` associated with the minimum value of `expression2`.
- [x] `kurtosis(expression) -> scalar` - Returns the kurtosis, a measure of the `tailedness` of the distribution, for the given numeric values in `expression`.
9 changes: 8 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,24 @@ use datafusion::logical_expr::AggregateUDF;
#[macro_use]
pub mod macros;
pub mod common;
pub mod kurtosis;
pub mod max_min_by;
pub mod mode;

pub mod expr_extra_fn {
pub use super::kurtosis::kurtosis;
pub use super::max_min_by::max_by;
pub use super::max_min_by::min_by;
pub use super::mode::mode;
}

pub fn all_extra_aggregate_functions() -> Vec<Arc<AggregateUDF>> {
vec![mode_udaf(), max_min_by::max_by_udaf(), max_min_by::min_by_udaf(), kurtosis::kurtosis_udaf()]
vec![
mode_udaf(),
max_min_by::max_by_udaf(),
max_min_by::min_by_udaf(),
kurtosis::kurtosis_udaf(),
]
}

/// Registers all enabled packages with a [`FunctionRegistry`]
Expand Down

0 comments on commit 1342ef9

Please sign in to comment.