When planning a SQL, DataFusion planner will strictly check the function usage. The used function should be registered in the SessionContext. In the Wren AI scenario, we always fully push down the SQL to the data source side. We can invoke the ByPassFunction (introduced by #802) which only requires the function name and return type to register a logical function for unparsing purposes.
This PR introduces a file-based register to define the required remote function easily.
Definition File
The definition file is a CSV file that contains 4 columns and with the header:
function_type: The possible value contains scalar, aggregate, and window. All of them are lowercase.
name: The function name.
return_type: The expected return type.
description: A simple description of this function. Because the description could contain a comma, we should quote the value.
Sample
function_type,name,return_type,description
scalar,add_two,int,"Adds two numbers together."
aggregate,median,int,"Returns the median value of a numeric column.".
window,max_if,int,"If the condition is true, returns the maximum value in the window."
Set up the config
On the ibis server side, we add a new environment variable called REMOTE_FUNCTION_LIST_PATH which is the path of the definition file. We should set up it before starting the server.
Description
When planning a SQL, DataFusion planner will strictly check the function usage. The used function should be registered in the SessionContext. In the Wren AI scenario, we always fully push down the SQL to the data source side. We can invoke the
ByPassFunction
(introduced by #802) which only requires the function name and return type to register a logical function for unparsing purposes.This PR introduces a file-based register to define the required remote function easily.
Definition File
The definition file is a CSV file that contains 4 columns and with the header:
function_type
: The possible value containsscalar
,aggregate
, andwindow
. All of them are lowercase.name
: The function name.return_type
: The expected return type.description
: A simple description of this function. Because the description could contain a comma, we should quote the value.Sample
Set up the config
On the ibis server side, we add a new environment variable called
REMOTE_FUNCTION_LIST_PATH
which is the path of the definition file. We should set up it before starting the server.Known Issue