-
-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
DuckDB::ScalarFunction is missing several features from the DuckDB C API. This issue tracks the full list.
Missing API methods
DuckDB::ScalarFunction
-
set_varargs(logical_type)— wrapduckdb_scalar_function_set_varargs. Allows accepting a variable number of arguments of a given type. -
set_special_handling— wrapduckdb_scalar_function_set_special_handling. Marks the function to receive NULL inputs. -
set_bind(&block)— wrapduckdb_scalar_function_set_bind. Enables dynamic return type resolution based on input types at bind time.
DuckDB::FunctionInfo
-
get_bind_data— wrapduckdb_scalar_function_get_bind_data. Allows the execute callback to retrieve data stored at bind time. -
set_error(scalar-specific) — wrapduckdb_scalar_function_set_error. Currently only the genericduckdb_function_set_erroris wrapped.
New class: DuckDB::ScalarFunctionBindInfo
The bind callback receives a duckdb_bind_info. Scalar-function-specific methods not yet wrapped:
-
set_bind_data(data, destroy_callback)—duckdb_scalar_function_set_bind_data -
set_bind_data_copy(copy_callback)—duckdb_scalar_function_set_bind_data_copy -
set_error(message)—duckdb_scalar_function_bind_set_error -
get_extra_info—duckdb_scalar_function_bind_get_extra_info -
argument_count—duckdb_scalar_function_bind_get_argument_count -
get_argument(index)—duckdb_scalar_function_bind_get_argument -
get_client_context—duckdb_scalar_function_get_client_context
New class: DuckDB::ScalarFunctionSet
Enables registering multiple type overloads under the same function name:
-
DuckDB::ScalarFunctionSet.new(name)—duckdb_create_scalar_function_set -
#add(scalar_function)—duckdb_add_scalar_function_to_set -
Connection#register_scalar_function_set(set)—duckdb_register_scalar_function_set
Missing type support in input/output handling
Currently handled: BOOLEAN, TINYINT, UTINYINT, SMALLINT, USMALLINT, INTEGER, UINTEGER, BIGINT, UBIGINT, FLOAT, DOUBLE, VARCHAR, BLOB, TIMESTAMP, DATE, TIME
Missing scalar types (straightforward)
-
HUGEINT,UHUGEINT— useduckdb_hugeint/duckdb_uhugeintstruct → RubyInteger -
TIMESTAMP_S,TIMESTAMP_MS,TIMESTAMP_NS,TIMESTAMP_TZ— same pattern asTIMESTAMP -
TIME_TZ,TIME_NS— same pattern asTIME -
INTERVAL— map to/fromDuckDB::Interval -
UUID— stored ashugeintinternally, expose asString -
DECIMAL— needswidth/scalemetadata from logical type
Missing complex types (harder, lower priority)
-
LIST,STRUCT,MAP,ARRAY,UNION,ENUM— require recursive child vector handling
Note: the same type gaps also exist in DuckDB::DataChunk#set_value used by the table function adapter, so fixing these would benefit both APIs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request