Skip to content

Apache DataFusion SQL Query Engine

add link of contributor guide for new functions to src (#7240)

Yongting Youd8692b119a0c
diff --git a/datafusion/expr/src/aggregate_function.rs b/datafusion/expr/src/aggregate_function.rs
index 876f746d05..d6cb5a1903 100644
--- a/datafusion/expr/src/aggregate_function.rs
+++ b/datafusion/expr/src/aggregate_function.rs
@@ -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
diff --git a/datafusion/expr/src/built_in_function.rs b/datafusion/expr/src/built_in_function.rs
index 061d0689cd..f239155a92 100644
--- a/datafusion/expr/src/built_in_function.rs
+++ b/datafusion/expr/src/built_in_function.rs
@@ -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
diff --git a/docs/source/contributor-guide/index.md b/docs/source/contributor-guide/index.md
index 5bb4e26b95..e42ab0dee0 100644
--- a/docs/source/contributor-guide/index.md
+++ b/docs/source/contributor-guide/index.md
@@ -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
@@ -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