class DuckDB::LogicalType
Public Instance Methods
Source
static VALUE duckdb_logical_type_child_type(VALUE self) { rubyDuckDBLogicalType *ctx; duckdb_type type_id; duckdb_logical_type child_logical_type; VALUE logical_type = Qnil; TypedData_Get_Struct(self, rubyDuckDBLogicalType, &logical_type_data_type, ctx); type_id = duckdb_get_type_id(ctx->logical_type); switch(type_id) { case DUCKDB_TYPE_LIST: case DUCKDB_TYPE_MAP: child_logical_type = duckdb_list_type_child_type(ctx->logical_type); logical_type = rbduckdb_create_logical_type(child_logical_type); break; case DUCKDB_TYPE_ARRAY: child_logical_type = duckdb_array_type_child_type(ctx->logical_type); logical_type = rbduckdb_create_logical_type(child_logical_type); break; default: logical_type = Qnil; } return logical_type; }
Returns the child logical type for list and map types, otherwise nil.
Source
static VALUE duckdb_logical_type_scale(VALUE self) { rubyDuckDBLogicalType *ctx; TypedData_Get_Struct(self, rubyDuckDBLogicalType, &logical_type_data_type, ctx); return INT2FIX(duckdb_decimal_scale(ctx->logical_type)); }
Returns the scale of the decimal column.
Source
static VALUE duckdb_logical_type_size(VALUE self) { rubyDuckDBLogicalType *ctx; TypedData_Get_Struct(self, rubyDuckDBLogicalType, &logical_type_data_type, ctx); return INT2FIX(duckdb_array_type_array_size(ctx->logical_type)); }
Returns the size of the array column, otherwise 0.
Source
# File lib/duckdb/logical_type.rb, line 17 def type type_id = _type DuckDB::Converter::IntToSym.type_to_sym(type_id) end
returns logical type’s type symbol ‘:unknown` means that the logical type’s type is unknown/unsupported by ruby-duckdb. ‘:invalid` means that the logical type’s type is invalid in duckdb.
require 'duckdb' db = DuckDB::Database.open con = db.connect con.query('CREATE TABLE climates (id INTEGER, temperature DECIMAIL)') users = con.query('SELECT * FROM climates') columns = users.columns columns.second.logical_type.type #=> :decimal
Source
static VALUE duckdb_logical_type_width(VALUE self) { rubyDuckDBLogicalType *ctx; TypedData_Get_Struct(self, rubyDuckDBLogicalType, &logical_type_data_type, ctx); return INT2FIX(duckdb_decimal_width(ctx->logical_type)); }
Returns the width of the decimal column.