Skip to content

Commit

Permalink
add link of contributor guide for new functions to src (#7240)
Browse files Browse the repository at this point in the history
  • Loading branch information
2010YOUY01 committed Aug 9, 2023
1 parent 3f6298d commit d8692b1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions datafusion/expr/src/aggregate_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ use std::{fmt, str::FromStr};
use strum_macros::EnumIter;

/// Enum of all built-in aggregate functions
// Contributor's guide for adding new aggregate functions
// https://arrow.apache.org/datafusion/contributor-guide/index.html#how-to-add-a-new-aggregate-function
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Hash, EnumIter)]
pub enum AggregateFunction {
/// count
Expand Down
2 changes: 2 additions & 0 deletions datafusion/expr/src/built_in_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ use strum_macros::EnumIter;
use lazy_static::lazy_static;

/// Enum of all built-in scalar functions
// Contributor's guide for adding new scalar functions
// https://arrow.apache.org/datafusion/contributor-guide/index.html#how-to-add-a-new-scalar-function
#[derive(Debug, Clone, PartialEq, Eq, Hash, EnumIter, Copy)]
pub enum BuiltinScalarFunction {
// math functions
Expand Down
8 changes: 6 additions & 2 deletions docs/source/contributor-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,11 @@ Below is a checklist of what you need to do to add a new scalar function to Data
- a new line in `signature` with the signature of the function (number and types of its arguments)
- a new line in `create_physical_expr`/`create_physical_fun` mapping the built-in to the implementation
- tests to the function.
- In [core/tests/sql](../../../datafusion/core/tests/sql), add a new test where the function is called through SQL against well known data and returns the expected result.
- In [core/tests/sqllogictests/test_files](../../../datafusion/core/tests/sqllogictests/test_files), add new `sqllogictest` integration tests where the function is called through SQL against well known data and returns the expected result.
- Documentation for `sqllogictest` [here](../../../datafusion/core/tests/sqllogictests/README.md)
- In [expr/src/expr_fn.rs](../../../datafusion/expr/src/expr_fn.rs), add:
- a new entry of the `unary_scalar_expr!` macro for the new function.
- Add SQL reference documentation [here](../../../docs/source/user-guide/sql/scalar_functions.md)

### How to add a new aggregate function

Expand All @@ -241,7 +243,9 @@ Below is a checklist of what you need to do to add a new aggregate function to D
- a new line in `signature` with the signature of the function (number and types of its arguments)
- a new line in `create_aggregate_expr` mapping the built-in to the implementation
- tests to the function.
- In [tests/sql](../../../datafusion/core/tests/sql), add a new test where the function is called through SQL against well known data and returns the expected result.
- In [core/tests/sqllogictests/test_files](../../../datafusion/core/tests/sqllogictests/test_files), add new `sqllogictest` integration tests where the function is called through SQL against well known data and returns the expected result.
- Documentation for `sqllogictest` [here](../../../datafusion/core/tests/sqllogictests/README.md)
- Add SQL reference documentation [here](../../../docs/source/user-guide/sql/aggregate_functions.md)

### How to display plans graphically

Expand Down

0 comments on commit d8692b1

Please sign in to comment.