duckdb 1.5.2.0 → 1.5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/duckdb.gemspec +37 -0
- data/ext/duckdb/aggregate_function.c +61 -100
- data/ext/duckdb/aggregate_function.h +2 -2
- data/ext/duckdb/appender.c +76 -35
- data/ext/duckdb/appender.h +1 -1
- data/ext/duckdb/client_context.c +5 -5
- data/ext/duckdb/client_context.h +2 -2
- data/ext/duckdb/column.c +13 -13
- data/ext/duckdb/column.h +1 -1
- data/ext/duckdb/connection.c +40 -41
- data/ext/duckdb/connection.h +2 -2
- data/ext/duckdb/converter.h +1 -7
- data/ext/duckdb/conveter.c +6 -6
- data/ext/duckdb/data_chunk.c +22 -22
- data/ext/duckdb/data_chunk.h +2 -2
- data/ext/duckdb/database.c +10 -10
- data/ext/duckdb/database.h +1 -1
- data/ext/duckdb/duckdb.c +17 -17
- data/ext/duckdb/expression.c +8 -8
- data/ext/duckdb/expression.h +1 -1
- data/ext/duckdb/extconf.rb +4 -3
- data/ext/duckdb/extracted_statements.c +15 -15
- data/ext/duckdb/extracted_statements.h +1 -1
- data/ext/duckdb/instance_cache.c +10 -10
- data/ext/duckdb/instance_cache.h +1 -1
- data/ext/duckdb/logical_type.c +94 -133
- data/ext/duckdb/logical_type.h +2 -2
- data/ext/duckdb/memory_helper.c +28 -28
- data/ext/duckdb/pending_result.c +27 -27
- data/ext/duckdb/pending_result.h +2 -2
- data/ext/duckdb/prepared_statement.c +103 -103
- data/ext/duckdb/prepared_statement.h +2 -2
- data/ext/duckdb/result.c +33 -33
- data/ext/duckdb/result.h +2 -3
- data/ext/duckdb/ruby-duckdb.h +4 -0
- data/ext/duckdb/scalar_function.c +3 -3
- data/ext/duckdb/table_description.c +1 -1
- data/ext/duckdb/table_function.c +3 -3
- data/ext/duckdb/table_function_bind_info.c +1 -1
- data/ext/duckdb/value.c +62 -50
- data/ext/duckdb/value.h +2 -2
- data/ext/duckdb/vector.c +20 -20
- data/ext/duckdb/vector.h +2 -2
- data/lib/duckdb/aggregate_function.rb +202 -3
- data/lib/duckdb/appender.rb +74 -0
- data/lib/duckdb/connection.rb +1 -16
- data/lib/duckdb/converter.rb +5 -0
- data/lib/duckdb/logical_type.rb +1 -3
- data/lib/duckdb/prepared_statement.rb +1 -1
- data/lib/duckdb/table_function.rb +0 -1
- data/lib/duckdb/value.rb +19 -0
- data/lib/duckdb/version.rb +1 -1
- metadata +2 -2
- data/lib/duckdb/duckdb_native.so +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c7c57e0282ec2213b1efb3844445804e5fbbc09e03496f2ba71c1bd24152843
|
|
4
|
+
data.tar.gz: 9057fa45fafeba0dc2110562f98cd49eecf53ec0f0a48a989756742525c82b4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78bbd166f587491085267791ffca949f2b310597f802424b7e0525c8c4f35f345c2362b17b33401bee374601d5f52746d10ac21f60ea8344bd3bf08e28d7f4b5
|
|
7
|
+
data.tar.gz: 6fc88b5e289ef3451691f57cb404c390b9deabbafddf81e8aedd300121276a9df62b0492559f2602eb4aeaa57ed2a83cc98ccfbef3a728771c34a565a022f78a
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
# Unreleased
|
|
6
6
|
|
|
7
|
+
# 1.5.2.1 - 2026-04-24
|
|
8
|
+
|
|
9
|
+
- add `DuckDB::AggregateFunction.create`.
|
|
10
|
+
- add `DuckDB::Appender#clear_columns`.
|
|
11
|
+
- add `DuckDB::Appender#add_column`.
|
|
12
|
+
- add `DuckDB::Appender#clear` to discard all unflushed data from the appender without writing it to the table (requires DuckDB >= 1.5.0).
|
|
13
|
+
- add `DuckDB::Value.create_decimal`.
|
|
14
|
+
- fix gemspec to use `git ls-files`, preventing precompiled x86_64 `.so` from being bundled into the gem and breaking non-x86 platforms.
|
|
15
|
+
|
|
7
16
|
# 1.5.2.0 - 2026-04-16
|
|
8
17
|
|
|
9
18
|
- add `DuckDB::DataChunk#reset` to clear a chunk's contents so it can be reused across multiple `Appender#append_data_chunk` calls without reallocation.
|
data/duckdb.gemspec
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'lib/duckdb/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'duckdb'
|
|
7
|
+
spec.version = DuckDB::VERSION
|
|
8
|
+
spec.authors = ['Masaki Suketa']
|
|
9
|
+
spec.email = ['masaki.suketa@nifty.ne.jp']
|
|
10
|
+
spec.homepage = 'https://github.com/suketa/ruby-duckdb'
|
|
11
|
+
spec.license = 'MIT'
|
|
12
|
+
|
|
13
|
+
spec.summary = 'Ruby bindings for the DuckDB database engine.'
|
|
14
|
+
spec.description = <<~TEXT
|
|
15
|
+
This gem provides bindings for DuckDB, which is an in-process SQL database optimized for analytical queries on structured data.
|
|
16
|
+
It's lightweight, embeddable, and works directly with files like Parquet and CSV, making it popular for data analysis tasks.
|
|
17
|
+
TEXT
|
|
18
|
+
|
|
19
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
21
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
|
22
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
23
|
+
|
|
24
|
+
# Specify which files should be added to the gem when it is released.
|
|
25
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
27
|
+
f.match(%r{^(test|spec|features|sample|benchmark)/|^\.(?!rdoc_options)|
|
|
28
|
+
^(HACKING|CONTRIBUTION)\.md$|
|
|
29
|
+
^(Dockerfile|docker-compose\.yml|getduckdb\.sh|Gemfile(\.lock)?)$}x)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
spec.require_paths = ['lib']
|
|
34
|
+
spec.extensions = ['ext/duckdb/extconf.rb']
|
|
35
|
+
spec.required_ruby_version = '>= 3.2.0'
|
|
36
|
+
spec.add_dependency 'bigdecimal', '>= 3.1.4'
|
|
37
|
+
end
|
|
@@ -32,15 +32,15 @@ static void deallocate(void *);
|
|
|
32
32
|
static VALUE allocate(VALUE klass);
|
|
33
33
|
static size_t memsize(const void *p);
|
|
34
34
|
static void compact(void *);
|
|
35
|
-
static VALUE
|
|
36
|
-
static VALUE
|
|
37
|
-
static VALUE
|
|
38
|
-
static VALUE
|
|
39
|
-
static VALUE
|
|
40
|
-
static VALUE
|
|
41
|
-
static VALUE
|
|
42
|
-
static VALUE
|
|
43
|
-
static VALUE
|
|
35
|
+
static VALUE aggregate_function_initialize(VALUE self);
|
|
36
|
+
static VALUE aggregate_function_set_name(VALUE self, VALUE name);
|
|
37
|
+
static VALUE aggregate_function__set_return_type(VALUE self, VALUE logical_type);
|
|
38
|
+
static VALUE aggregate_function__add_parameter(VALUE self, VALUE logical_type);
|
|
39
|
+
static VALUE aggregate_function__set_init(VALUE self);
|
|
40
|
+
static VALUE aggregate_function__set_update(VALUE self);
|
|
41
|
+
static VALUE aggregate_function__set_combine(VALUE self);
|
|
42
|
+
static VALUE aggregate_function__set_finalize(VALUE self);
|
|
43
|
+
static VALUE aggregate_function__set_special_handling(VALUE self);
|
|
44
44
|
|
|
45
45
|
static const rb_data_type_t aggregate_function_data_type = {
|
|
46
46
|
"DuckDB/AggregateFunction",
|
|
@@ -87,13 +87,13 @@ static size_t memsize(const void *p) {
|
|
|
87
87
|
return sizeof(rubyDuckDBAggregateFunction);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
rubyDuckDBAggregateFunction *
|
|
90
|
+
rubyDuckDBAggregateFunction *rbduckdb_get_struct_aggregate_function(VALUE obj) {
|
|
91
91
|
rubyDuckDBAggregateFunction *ctx;
|
|
92
92
|
TypedData_Get_Struct(obj, rubyDuckDBAggregateFunction, &aggregate_function_data_type, ctx);
|
|
93
93
|
return ctx;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
static VALUE
|
|
96
|
+
static VALUE aggregate_function_initialize(VALUE self) {
|
|
97
97
|
rubyDuckDBAggregateFunction *p;
|
|
98
98
|
TypedData_Get_Struct(self, rubyDuckDBAggregateFunction, &aggregate_function_data_type, p);
|
|
99
99
|
p->aggregate_function = duckdb_create_aggregate_function();
|
|
@@ -105,7 +105,7 @@ static VALUE duckdb_aggregate_function_initialize(VALUE self) {
|
|
|
105
105
|
return self;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
static VALUE
|
|
108
|
+
static VALUE aggregate_function_set_name(VALUE self, VALUE name) {
|
|
109
109
|
rubyDuckDBAggregateFunction *p;
|
|
110
110
|
TypedData_Get_Struct(self, rubyDuckDBAggregateFunction, &aggregate_function_data_type, p);
|
|
111
111
|
|
|
@@ -115,24 +115,24 @@ static VALUE rbduckdb_aggregate_function_set_name(VALUE self, VALUE name) {
|
|
|
115
115
|
return self;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
static VALUE
|
|
118
|
+
static VALUE aggregate_function__set_return_type(VALUE self, VALUE logical_type) {
|
|
119
119
|
rubyDuckDBAggregateFunction *p;
|
|
120
120
|
rubyDuckDBLogicalType *lt;
|
|
121
121
|
|
|
122
122
|
TypedData_Get_Struct(self, rubyDuckDBAggregateFunction, &aggregate_function_data_type, p);
|
|
123
|
-
lt =
|
|
123
|
+
lt = rbduckdb_get_struct_logical_type(logical_type);
|
|
124
124
|
|
|
125
125
|
duckdb_aggregate_function_set_return_type(p->aggregate_function, lt->logical_type);
|
|
126
126
|
|
|
127
127
|
return self;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
static VALUE
|
|
130
|
+
static VALUE aggregate_function__add_parameter(VALUE self, VALUE logical_type) {
|
|
131
131
|
rubyDuckDBAggregateFunction *p;
|
|
132
132
|
rubyDuckDBLogicalType *lt;
|
|
133
133
|
|
|
134
134
|
TypedData_Get_Struct(self, rubyDuckDBAggregateFunction, &aggregate_function_data_type, p);
|
|
135
|
-
lt =
|
|
135
|
+
lt = rbduckdb_get_struct_logical_type(logical_type);
|
|
136
136
|
|
|
137
137
|
duckdb_aggregate_function_add_parameter(p->aggregate_function, lt->logical_type);
|
|
138
138
|
|
|
@@ -237,15 +237,6 @@ static void state_init_callback(duckdb_function_info info, duckdb_aggregate_stat
|
|
|
237
237
|
rbduckdb_function_executor_dispatch(execute_init_callback_protected, &arg);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
/* No-op update: used when no update_proc has been supplied. */
|
|
241
|
-
static void noop_update_callback(duckdb_function_info info,
|
|
242
|
-
duckdb_data_chunk input,
|
|
243
|
-
duckdb_aggregate_state *states) {
|
|
244
|
-
(void)info;
|
|
245
|
-
(void)input;
|
|
246
|
-
(void)states;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
240
|
/* update callback dispatch argument */
|
|
250
241
|
struct update_callback_arg {
|
|
251
242
|
rubyDuckDBAggregateFunction *ctx;
|
|
@@ -387,7 +378,14 @@ static void update_callback(duckdb_function_info info,
|
|
|
387
378
|
struct update_callback_arg arg;
|
|
388
379
|
|
|
389
380
|
ctx = (rubyDuckDBAggregateFunction *)duckdb_aggregate_function_get_extra_info(info);
|
|
390
|
-
if (ctx == NULL
|
|
381
|
+
if (ctx == NULL) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (ctx->update_proc == Qnil) {
|
|
385
|
+
/* Reached only if _set_init was called directly (bypassing the Ruby
|
|
386
|
+
* wrapper) without setting an update proc. Raise rather than silently
|
|
387
|
+
* leaving state unchanged. */
|
|
388
|
+
duckdb_aggregate_function_set_error(info, "update callback invoked with no update proc set");
|
|
391
389
|
return;
|
|
392
390
|
}
|
|
393
391
|
|
|
@@ -404,56 +402,6 @@ static void update_callback(duckdb_function_info info,
|
|
|
404
402
|
rbduckdb_function_executor_dispatch(execute_update_callback_protected, &arg);
|
|
405
403
|
}
|
|
406
404
|
|
|
407
|
-
/* No-op combine: Phase 1.0 does not dispatch combine to Ruby. */
|
|
408
|
-
static void noop_combine_callback(duckdb_function_info info,
|
|
409
|
-
duckdb_aggregate_state *source,
|
|
410
|
-
duckdb_aggregate_state *target,
|
|
411
|
-
idx_t count) {
|
|
412
|
-
(void)info;
|
|
413
|
-
(void)source;
|
|
414
|
-
(void)target;
|
|
415
|
-
(void)count;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/*
|
|
419
|
-
* Fallback combine used when update_proc is supplied but the user did not
|
|
420
|
-
* register a combine_proc via set_combine.
|
|
421
|
-
*
|
|
422
|
-
* DuckDB invokes combine even for single-partition aggregates: after update
|
|
423
|
-
* has accumulated values into a source state, DuckDB freshly initialises a
|
|
424
|
-
* target state and calls combine to merge source into target before finalize.
|
|
425
|
-
*
|
|
426
|
-
* Without a user-provided combine_proc we cannot perform an arbitrary merge,
|
|
427
|
-
* so this minimal implementation overwrites target->ruby_state with the
|
|
428
|
-
* source value. This is correct for the common single-group/single-thread
|
|
429
|
-
* path; parallel execution requires the user to supply a combine_proc via
|
|
430
|
-
* set_combine, in which case combine_callback is wired instead of this
|
|
431
|
-
* fallback.
|
|
432
|
-
*/
|
|
433
|
-
static void default_combine_callback(duckdb_function_info info,
|
|
434
|
-
duckdb_aggregate_state *source,
|
|
435
|
-
duckdb_aggregate_state *target,
|
|
436
|
-
idx_t count) {
|
|
437
|
-
ruby_aggregate_state **src = (ruby_aggregate_state **)source;
|
|
438
|
-
ruby_aggregate_state **tgt = (ruby_aggregate_state **)target;
|
|
439
|
-
idx_t i;
|
|
440
|
-
(void)info;
|
|
441
|
-
|
|
442
|
-
for (i = 0; i < count; i++) {
|
|
443
|
-
tgt[i]->ruby_state = src[i]->ruby_state;
|
|
444
|
-
/*
|
|
445
|
-
* Do NOT call any Ruby API here. This callback is invoked by a
|
|
446
|
-
* DuckDB worker thread that does not hold the GVL; any rb_* call
|
|
447
|
-
* from this context is unsafe and causes a SIGSEGV on Windows.
|
|
448
|
-
*
|
|
449
|
-
* The copied VALUE is already GC-protected via the source state's
|
|
450
|
-
* existing registry entry — which shares the same state_id (because
|
|
451
|
-
* DuckDB memcpy'd the buffer). The destructor callback will clean
|
|
452
|
-
* up that entry when DuckDB frees the source state.
|
|
453
|
-
*/
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
405
|
/* combine_callback dispatch argument */
|
|
458
406
|
struct combine_callback_arg {
|
|
459
407
|
rubyDuckDBAggregateFunction *ctx;
|
|
@@ -515,7 +463,13 @@ static void combine_callback(duckdb_function_info info,
|
|
|
515
463
|
struct combine_callback_arg arg;
|
|
516
464
|
|
|
517
465
|
ctx = (rubyDuckDBAggregateFunction *)duckdb_aggregate_function_get_extra_info(info);
|
|
518
|
-
if (ctx == NULL
|
|
466
|
+
if (ctx == NULL) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
if (ctx->combine_proc == Qnil) {
|
|
470
|
+
/* Reached only if _set_init was called directly (bypassing the Ruby
|
|
471
|
+
* wrapper) without setting a combine proc. Raise rather than SIGSEGV. */
|
|
472
|
+
duckdb_aggregate_function_set_error(info, "combine callback invoked with no combine proc set");
|
|
519
473
|
return;
|
|
520
474
|
}
|
|
521
475
|
|
|
@@ -616,7 +570,13 @@ static void finalize_callback(duckdb_function_info info,
|
|
|
616
570
|
struct finalize_callback_arg arg;
|
|
617
571
|
|
|
618
572
|
ctx = (rubyDuckDBAggregateFunction *)duckdb_aggregate_function_get_extra_info(info);
|
|
619
|
-
if (ctx == NULL
|
|
573
|
+
if (ctx == NULL) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (ctx->finalize_proc == Qnil) {
|
|
577
|
+
/* Reached only if _set_init was called directly (bypassing the Ruby
|
|
578
|
+
* wrapper) without setting a finalize proc. Raise rather than SIGSEGV. */
|
|
579
|
+
duckdb_aggregate_function_set_error(info, "finalize callback invoked with no finalize proc set");
|
|
620
580
|
return;
|
|
621
581
|
}
|
|
622
582
|
|
|
@@ -667,10 +627,12 @@ static void destroy_callback(duckdb_aggregate_state *states, idx_t count) {
|
|
|
667
627
|
|
|
668
628
|
/*
|
|
669
629
|
* Wire up all 5 DuckDB aggregate callbacks on the underlying aggregate_function.
|
|
670
|
-
* Called once
|
|
630
|
+
* Called once init_proc has been supplied. combine_proc and finalize_proc are
|
|
631
|
+
* guaranteed non-nil by the Ruby wrapper (set_init injects defaults for all
|
|
632
|
+
* three before calling _set_init).
|
|
671
633
|
*/
|
|
672
634
|
static void maybe_set_functions(rubyDuckDBAggregateFunction *p) {
|
|
673
|
-
if (p->init_proc == Qnil
|
|
635
|
+
if (p->init_proc == Qnil) {
|
|
674
636
|
return;
|
|
675
637
|
}
|
|
676
638
|
duckdb_aggregate_function_set_extra_info(p->aggregate_function, p, NULL);
|
|
@@ -678,9 +640,8 @@ static void maybe_set_functions(rubyDuckDBAggregateFunction *p) {
|
|
|
678
640
|
p->aggregate_function,
|
|
679
641
|
state_size_callback,
|
|
680
642
|
state_init_callback,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
((p->update_proc != Qnil) ? default_combine_callback : noop_combine_callback),
|
|
643
|
+
update_callback,
|
|
644
|
+
combine_callback,
|
|
684
645
|
finalize_callback);
|
|
685
646
|
duckdb_aggregate_function_set_destructor(p->aggregate_function, destroy_callback);
|
|
686
647
|
|
|
@@ -690,7 +651,7 @@ static void maybe_set_functions(rubyDuckDBAggregateFunction *p) {
|
|
|
690
651
|
}
|
|
691
652
|
|
|
692
653
|
/* :nodoc: */
|
|
693
|
-
static VALUE
|
|
654
|
+
static VALUE aggregate_function__set_init(VALUE self) {
|
|
694
655
|
rubyDuckDBAggregateFunction *p;
|
|
695
656
|
|
|
696
657
|
if (!rb_block_given_p()) {
|
|
@@ -706,7 +667,7 @@ static VALUE rbduckdb_aggregate_function_set_init(VALUE self) {
|
|
|
706
667
|
}
|
|
707
668
|
|
|
708
669
|
/* :nodoc: */
|
|
709
|
-
static VALUE
|
|
670
|
+
static VALUE aggregate_function__set_update(VALUE self) {
|
|
710
671
|
rubyDuckDBAggregateFunction *p;
|
|
711
672
|
|
|
712
673
|
if (!rb_block_given_p()) {
|
|
@@ -722,7 +683,7 @@ static VALUE rbduckdb_aggregate_function_set_update(VALUE self) {
|
|
|
722
683
|
}
|
|
723
684
|
|
|
724
685
|
/* :nodoc: */
|
|
725
|
-
static VALUE
|
|
686
|
+
static VALUE aggregate_function__set_combine(VALUE self) {
|
|
726
687
|
rubyDuckDBAggregateFunction *p;
|
|
727
688
|
|
|
728
689
|
if (!rb_block_given_p()) {
|
|
@@ -738,7 +699,7 @@ static VALUE rbduckdb_aggregate_function_set_combine(VALUE self) {
|
|
|
738
699
|
}
|
|
739
700
|
|
|
740
701
|
/* :nodoc: */
|
|
741
|
-
static VALUE
|
|
702
|
+
static VALUE aggregate_function__set_finalize(VALUE self) {
|
|
742
703
|
rubyDuckDBAggregateFunction *p;
|
|
743
704
|
|
|
744
705
|
if (!rb_block_given_p()) {
|
|
@@ -754,7 +715,7 @@ static VALUE rbduckdb_aggregate_function_set_finalize(VALUE self) {
|
|
|
754
715
|
}
|
|
755
716
|
|
|
756
717
|
/* :nodoc: */
|
|
757
|
-
static VALUE
|
|
718
|
+
static VALUE aggregate_function__set_special_handling(VALUE self) {
|
|
758
719
|
rubyDuckDBAggregateFunction *p;
|
|
759
720
|
TypedData_Get_Struct(self, rubyDuckDBAggregateFunction, &aggregate_function_data_type, p);
|
|
760
721
|
p->special_handling = true;
|
|
@@ -763,28 +724,28 @@ static VALUE rbduckdb_aggregate_function__set_special_handling(VALUE self) {
|
|
|
763
724
|
}
|
|
764
725
|
|
|
765
726
|
/* Returns the number of Ruby states currently tracked in the registry. */
|
|
766
|
-
static VALUE
|
|
727
|
+
static VALUE aggregate_function_s__state_registry_size(VALUE klass) {
|
|
767
728
|
(void)klass;
|
|
768
729
|
return LONG2NUM((long)RHASH_SIZE(g_aggregate_state_registry));
|
|
769
730
|
}
|
|
770
731
|
|
|
771
|
-
void
|
|
732
|
+
void rbduckdb_init_aggregate_function(void) {
|
|
772
733
|
#if 0
|
|
773
734
|
VALUE mDuckDB = rb_define_module("DuckDB");
|
|
774
735
|
#endif
|
|
775
736
|
cDuckDBAggregateFunction = rb_define_class_under(mDuckDB, "AggregateFunction", rb_cObject);
|
|
776
737
|
rb_define_alloc_func(cDuckDBAggregateFunction, allocate);
|
|
777
|
-
rb_define_method(cDuckDBAggregateFunction, "initialize",
|
|
778
|
-
rb_define_method(cDuckDBAggregateFunction, "name=",
|
|
779
|
-
rb_define_private_method(cDuckDBAggregateFunction, "_set_return_type",
|
|
780
|
-
rb_define_private_method(cDuckDBAggregateFunction, "_add_parameter",
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
rb_define_private_method(cDuckDBAggregateFunction, "_set_special_handling",
|
|
738
|
+
rb_define_method(cDuckDBAggregateFunction, "initialize", aggregate_function_initialize, 0);
|
|
739
|
+
rb_define_method(cDuckDBAggregateFunction, "name=", aggregate_function_set_name, 1);
|
|
740
|
+
rb_define_private_method(cDuckDBAggregateFunction, "_set_return_type", aggregate_function__set_return_type, 1);
|
|
741
|
+
rb_define_private_method(cDuckDBAggregateFunction, "_add_parameter", aggregate_function__add_parameter, 1);
|
|
742
|
+
rb_define_private_method(cDuckDBAggregateFunction, "_set_init", aggregate_function__set_init, 0);
|
|
743
|
+
rb_define_private_method(cDuckDBAggregateFunction, "_set_update", aggregate_function__set_update, 0);
|
|
744
|
+
rb_define_private_method(cDuckDBAggregateFunction, "_set_combine", aggregate_function__set_combine, 0);
|
|
745
|
+
rb_define_private_method(cDuckDBAggregateFunction, "_set_finalize", aggregate_function__set_finalize, 0);
|
|
746
|
+
rb_define_private_method(cDuckDBAggregateFunction, "_set_special_handling", aggregate_function__set_special_handling, 0);
|
|
786
747
|
rb_define_singleton_method(cDuckDBAggregateFunction, "_state_registry_size",
|
|
787
|
-
|
|
748
|
+
aggregate_function_s__state_registry_size, 0);
|
|
788
749
|
|
|
789
750
|
g_aggregate_state_registry = rb_hash_new();
|
|
790
751
|
rb_gc_register_mark_object(g_aggregate_state_registry);
|
|
@@ -12,7 +12,7 @@ struct _rubyDuckDBAggregateFunction {
|
|
|
12
12
|
|
|
13
13
|
typedef struct _rubyDuckDBAggregateFunction rubyDuckDBAggregateFunction;
|
|
14
14
|
|
|
15
|
-
void
|
|
16
|
-
rubyDuckDBAggregateFunction *
|
|
15
|
+
void rbduckdb_init_aggregate_function(void);
|
|
16
|
+
rubyDuckDBAggregateFunction *rbduckdb_get_struct_aggregate_function(VALUE obj);
|
|
17
17
|
|
|
18
18
|
#endif
|