extension/core_functions/README.md
core_functions contains the set of functions that is included in the core system.
These functions are bundled with every installation of DuckDB.
In order to add new functions, add their definition to the functions.json file in the respective directory.
The function headers can then be generated from the set of functions using the following command:
python3 scripts/generate_functions.py
Functions are defined according to the following format:
{
"name": "date_diff",
"parameters": "part,startdate,enddate",
"description": "The number of partition boundaries between the timestamps",
"example": "date_diff('hour', TIMESTAMPTZ '1992-09-30 23:59:59', TIMESTAMPTZ '1992-10-01 01:58:00')",
"type": "scalar_function_set",
"struct": "DateDiffFun",
"aliases": ["datediff"]
}
scalar_function, scalar_function_set, aggregate_function, etc.Fun added to the end, e.g. date_diff -> DateDiffFun.Scalar functions require the following function to be defined:
ScalarFunction DateDiffFun::GetFunction() {
return ...
}
Scalar function sets require the following function to be defined:
ScalarFunctionSet DateDiffFun::GetFunctions() {
return ...
}