Class: DuckDB::TableFunction::FunctionInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/duckdb/table_function/function_info.rb,
ext/duckdb/table_function_function_info.c

Overview

The DuckDB::TableFunction::FunctionInfo provides context during table function execution.

It is passed to the execute callback along with the output DataChunk.

Example:

table_function.execute do |func_info, output|
  # Report errors during execution
  func_info.set_error('Something went wrong')
end

rubocop:disable Lint/EmptyClass

Instance Method Summary collapse

Instance Method Details

#set_error(error_message) ⇒ self

Sets an error message for the function execution. This will cause the query to fail with the specified error.

function_info.set_error('Invalid parameter value')

Returns:

  • (self)


45
46
47
48
49
50
51
52
53
54
55
# File 'ext/duckdb/table_function_function_info.c', line 45

static VALUE rbduckdb_function_info_set_error(VALUE self, VALUE error) {
    rubyDuckDBFunctionInfo *ctx;
    const char *error_msg;

    TypedData_Get_Struct(self, rubyDuckDBFunctionInfo, &function_info_data_type, ctx);

    error_msg = StringValueCStr(error);
    duckdb_function_set_error(ctx->info, error_msg);

    return self;
}