1212#include "error.h"
1313#include "table_filter.h"
1414#include "duckdb_vx/data.h"
15- #include "duckdb_vx/client_context.h"
1615
17- #ifdef __cplusplus /* If compiled as C++, use C ABI */
16+ #ifdef __cplusplus
1817extern "C" {
1918#endif
2019
2120// Info passed into the bind callback. The callback should set error or else add result columns.
2221typedef struct duckdb_vx_tfunc_bind_input_ * duckdb_vx_tfunc_bind_input ;
2322typedef struct duckdb_vx_tfunc_bind_result_ * duckdb_vx_tfunc_bind_result ;
2423
25- // Fetch the parameter count from the bind info.
26- size_t duckdb_vx_tfunc_bind_input_get_parameter_count (duckdb_vx_tfunc_bind_input ffi_input );
27-
2824// Fetch a parameter from the bind info.
2925// The caller is responsible for freeing the value using duckdb_value_free.
3026duckdb_value duckdb_vx_tfunc_bind_input_get_parameter (duckdb_vx_tfunc_bind_input ffi_input , size_t index );
3127
32- duckdb_value duckdb_vx_tfunc_bind_input_get_named_parameter (duckdb_vx_tfunc_bind_input ffi_input ,
33- const char * name_str );
34-
3528// Add a result column to the bind info.
3629void duckdb_vx_tfunc_bind_result_add_column (duckdb_vx_tfunc_bind_result ffi_result ,
3730 const char * name_str ,
@@ -90,33 +83,20 @@ typedef struct {
9083 bool has_null ;
9184} duckdb_column_statistics ;
9285
93- typedef idx_t column_t ;
94-
95- // A transparent DuckDB table function vtable, which can be used to configure a table function.
96- // See duckdb/include/function/tfunc.hpp for details on each field.
86+ // vtable mimicking subset of TableFunction.
87+ // See duckdb/include/function/tfunc.hpp
9788typedef struct {
98- // The name of the table function.
9989 const char * name ;
100-
101- // The parameters of the table function.
10290 const duckdb_logical_type * parameters ;
10391 size_t parameter_count ;
10492
105- // The named parameters of the table function.
106- const duckdb_logical_type * named_parameter_types ;
107- const char * const * named_parameter_names ;
108- size_t named_parameter_count ;
109-
11093 duckdb_vx_data (* bind )(duckdb_client_context ctx ,
11194 duckdb_vx_tfunc_bind_input input ,
11295 duckdb_vx_tfunc_bind_result result ,
11396 duckdb_vx_error * error_out );
11497
11598 duckdb_vx_data (* bind_data_clone )(const void * bind_data , duckdb_vx_error * error_out );
11699
117- // void *bind_replace;
118- // void *bind_operator;
119-
120100 duckdb_vx_data (* init_global )(const duckdb_vx_tfunc_init_input * input , duckdb_vx_error * error_out );
121101
122102 duckdb_vx_data (* init_local )(const duckdb_vx_tfunc_init_input * input ,
@@ -130,22 +110,15 @@ typedef struct {
130110 duckdb_data_chunk data_chunk_out ,
131111 duckdb_vx_error * error_out );
132112
133- // void *in_out_function;
134- // void *in_out_function_final;
135-
136- // false if statistics are not available
137113 bool (* statistics )(duckdb_client_context context ,
138114 const void * bind_data ,
139115 size_t column_index ,
140116 duckdb_column_statistics * stats_out );
141117
142- // void *dependency;
143118 void (* cardinality )(void * bind_data , duckdb_vx_node_statistics * node_stats_out );
144119
145120 bool (* pushdown_complex_filter )(void * bind_data , duckdb_vx_expr expr , duckdb_vx_error * error_out );
146121
147- void * pushdown_expression ;
148-
149122 void (* to_string )(void * bind_data , duckdb_vx_string_map map );
150123
151124 double (* table_scan_progress )(duckdb_client_context ctx , void * bind_data , void * global_state );
@@ -154,25 +127,11 @@ typedef struct {
154127 void * init_global_data ,
155128 void * init_local_data ,
156129 duckdb_vx_error * error_out );
157- // void *get_bind_info;
158- // void *type_pushdown;
159- // void *get_multi_file_reader;
160- // void *supports_pushdown_type;
161- // void *get_partition_info;
162- // void *get_partition_stats;
163- // void *get_row_id_columns;
164-
165- bool projection_pushdown ;
166- bool filter_pushdown ;
167- bool filter_prune ;
168- bool sampling_pushdown ;
169- bool late_materialization ;
170- idx_t max_threads ;
171130} duckdb_vx_tfunc_vtab_t ;
172131
173132// A single function for configuring the DuckDB table function vtable.
174133duckdb_state duckdb_vx_tfunc_register (duckdb_database ffi_db , const duckdb_vx_tfunc_vtab_t * vtab );
175134
176- #ifdef __cplusplus /* End C ABI */
135+ #ifdef __cplusplus
177136}
178137#endif
0 commit comments