duckdb 1.4.4.0 → 1.5.0.0
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/.github/workflows/test_on_macos.yml +2 -2
- data/.github/workflows/test_on_ubuntu.yml +2 -2
- data/.github/workflows/test_on_windows.yml +1 -1
- data/CHANGELOG.md +8 -0
- data/Dockerfile +1 -12
- data/Gemfile +0 -9
- data/Gemfile.lock +3 -24
- data/ext/duckdb/appender.c +0 -15
- data/ext/duckdb/extconf.rb +4 -5
- data/ext/duckdb/ruby-duckdb.h +2 -2
- data/lib/duckdb/connection.rb +0 -21
- data/lib/duckdb/prepared_statement.rb +0 -5
- data/lib/duckdb/version.rb +1 -1
- metadata +1 -3
- data/benchmark/async_query.rb +0 -88
- data/sample/async_query_stream.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6967e763877e2be25116e63383c683925023ba9d51f606da6ebf1479f3725218
|
|
4
|
+
data.tar.gz: 4b024d154a89394ae168b066aff4073c3a26c1166177bccafad9e9c534dba1ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4ac2ab683a46d76848b78cbcbe6505fb7adba13d5ea17eeb3565993b956a348180a2c1db870593acbc6ec5a2ee9313db6c7668652706a542e90a67ba4e59f415
|
|
7
|
+
data.tar.gz: bcbb01e9178545de06088061aa5a24aae405db4f9c970ef5383a636ae777ce791858c634fdc7f0fbb1d8812831c78221349c4df689f929a39648022625094824
|
|
@@ -20,8 +20,8 @@ jobs:
|
|
|
20
20
|
timeout-minutes: 120
|
|
21
21
|
strategy:
|
|
22
22
|
matrix:
|
|
23
|
-
ruby: ['3.2.9', '3.3.10', '3.4.
|
|
24
|
-
duckdb: ['1.4.4', '1.
|
|
23
|
+
ruby: ['3.2.9', '3.3.10', '3.4.9', '4.0.1', 'head']
|
|
24
|
+
duckdb: ['1.4.4', '1.5.0']
|
|
25
25
|
|
|
26
26
|
steps:
|
|
27
27
|
- uses: actions/checkout@v4
|
|
@@ -20,8 +20,8 @@ jobs:
|
|
|
20
20
|
timeout-minutes: 120
|
|
21
21
|
strategy:
|
|
22
22
|
matrix:
|
|
23
|
-
ruby: ['3.2.9', '3.3.10', '3.4.
|
|
24
|
-
duckdb: ['1.4.4', '1.
|
|
23
|
+
ruby: ['3.2.9', '3.3.10', '3.4.9', '4.0.1', 'head']
|
|
24
|
+
duckdb: ['1.4.4', '1.5.0']
|
|
25
25
|
|
|
26
26
|
steps:
|
|
27
27
|
- uses: actions/checkout@v4
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
# Unreleased
|
|
6
6
|
|
|
7
|
+
# 1.5.5.0 - 2026-03-15
|
|
8
|
+
- bump duckdb to 1.5.0 on CI.
|
|
9
|
+
|
|
10
|
+
## Breaking changes
|
|
11
|
+
- remove `DuckDB::PrepareadStatement#pending_prepared_stream` method. Use `DuckDB::PreparedStatement#pending_prepared` instead.
|
|
12
|
+
- remove `DuckDB::Connection#async_query_stream` method. Use `DuckDB::Connection#async_query` instead.
|
|
13
|
+
- drop duckdb v1.3.x.
|
|
14
|
+
|
|
7
15
|
# 1.4.4.0 - 2026-03-07
|
|
8
16
|
- `DuckDB::DataChunk#set_value` accepts date.
|
|
9
17
|
- add `DuckDB::LogicalType.create_array` to create an array logical type
|
data/Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
ARG RUBY_VERSION=4.0.1
|
|
2
2
|
FROM ruby:${RUBY_VERSION}
|
|
3
3
|
|
|
4
|
-
ARG DUCKDB_VERSION=1.
|
|
4
|
+
ARG DUCKDB_VERSION=1.5.0
|
|
5
5
|
ARG VALGRIND_VERSION=3.21.0
|
|
6
6
|
|
|
7
7
|
RUN apt-get update -qq && \
|
|
@@ -16,17 +16,6 @@ RUN unzip duckdb.zip -d libduckdb && \
|
|
|
16
16
|
mv libduckdb/libduckdb.so /usr/local/lib && \
|
|
17
17
|
ldconfig /usr/local/lib
|
|
18
18
|
|
|
19
|
-
RUN mkdir valgrind-tmp && \
|
|
20
|
-
cd valgrind-tmp && \
|
|
21
|
-
wget https://sourceware.org/pub/valgrind/valgrind-${VALGRIND_VERSION}.tar.bz2 && \
|
|
22
|
-
tar xf valgrind-${VALGRIND_VERSION}.tar.bz2 && \
|
|
23
|
-
cd valgrind-${VALGRIND_VERSION} && \
|
|
24
|
-
./configure && \
|
|
25
|
-
make -s && \
|
|
26
|
-
make -s install && \
|
|
27
|
-
cd .. && \
|
|
28
|
-
rm -rf /valgrind-tmp
|
|
29
|
-
|
|
30
19
|
COPY . /root/ruby-duckdb
|
|
31
20
|
WORKDIR /root/ruby-duckdb
|
|
32
21
|
RUN git config --global --add safe.directory /root/ruby-duckdb
|
data/Gemfile
CHANGED
|
@@ -11,15 +11,6 @@ gem 'minitest', '~> 6.0'
|
|
|
11
11
|
gem 'rake', '~> 13.0'
|
|
12
12
|
gem 'rake-compiler'
|
|
13
13
|
|
|
14
|
-
if /(linux|darwin)/ =~ RUBY_PLATFORM
|
|
15
|
-
gem 'benchmark-ips'
|
|
16
|
-
gem 'stackprof'
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
if /linux/ =~ RUBY_PLATFORM
|
|
20
|
-
gem 'ruby_memcheck'
|
|
21
|
-
end
|
|
22
|
-
|
|
23
14
|
gem 'rubocop', require: false
|
|
24
15
|
gem 'rubocop-minitest', require: false
|
|
25
16
|
gem 'rubocop-rake', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
duckdb (1.
|
|
4
|
+
duckdb (1.5.0.0)
|
|
5
5
|
bigdecimal (>= 3.1.4)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -10,11 +10,10 @@ GEM
|
|
|
10
10
|
addressable (2.8.9)
|
|
11
11
|
public_suffix (>= 2.0.2, < 8.0)
|
|
12
12
|
ast (2.4.3)
|
|
13
|
-
benchmark-ips (2.14.0)
|
|
14
13
|
bigdecimal (4.0.1)
|
|
15
14
|
csv (3.3.5)
|
|
16
15
|
drb (2.2.3)
|
|
17
|
-
json (2.19.
|
|
16
|
+
json (2.19.1)
|
|
18
17
|
json-schema (6.2.0)
|
|
19
18
|
addressable (~> 2.8)
|
|
20
19
|
bigdecimal (>= 3.1, < 5)
|
|
@@ -22,23 +21,9 @@ GEM
|
|
|
22
21
|
lint_roller (1.1.0)
|
|
23
22
|
mcp (0.8.0)
|
|
24
23
|
json-schema (>= 4.1)
|
|
25
|
-
mini_portile2 (2.8.9)
|
|
26
24
|
minitest (6.0.2)
|
|
27
25
|
drb (~> 2.0)
|
|
28
26
|
prism (~> 1.5)
|
|
29
|
-
nokogiri (1.19.1)
|
|
30
|
-
mini_portile2 (~> 2.8.2)
|
|
31
|
-
racc (~> 1.4)
|
|
32
|
-
nokogiri (1.19.1-aarch64-linux-gnu)
|
|
33
|
-
racc (~> 1.4)
|
|
34
|
-
nokogiri (1.19.1-arm-linux-gnu)
|
|
35
|
-
racc (~> 1.4)
|
|
36
|
-
nokogiri (1.19.1-arm64-darwin)
|
|
37
|
-
racc (~> 1.4)
|
|
38
|
-
nokogiri (1.19.1-x86_64-darwin)
|
|
39
|
-
racc (~> 1.4)
|
|
40
|
-
nokogiri (1.19.1-x86_64-linux-gnu)
|
|
41
|
-
racc (~> 1.4)
|
|
42
27
|
parallel (1.27.0)
|
|
43
28
|
parser (3.3.10.2)
|
|
44
29
|
ast (~> 2.4.1)
|
|
@@ -63,7 +48,7 @@ GEM
|
|
|
63
48
|
rubocop-ast (>= 1.49.0, < 2.0)
|
|
64
49
|
ruby-progressbar (~> 1.7)
|
|
65
50
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
66
|
-
rubocop-ast (1.49.
|
|
51
|
+
rubocop-ast (1.49.1)
|
|
67
52
|
parser (>= 3.3.7.2)
|
|
68
53
|
prism (~> 1.7)
|
|
69
54
|
rubocop-minitest (0.39.1)
|
|
@@ -74,9 +59,6 @@ GEM
|
|
|
74
59
|
lint_roller (~> 1.1)
|
|
75
60
|
rubocop (>= 1.72.1)
|
|
76
61
|
ruby-progressbar (1.13.0)
|
|
77
|
-
ruby_memcheck (3.0.1)
|
|
78
|
-
nokogiri
|
|
79
|
-
stackprof (0.2.28)
|
|
80
62
|
unicode-display_width (3.2.0)
|
|
81
63
|
unicode-emoji (~> 4.1)
|
|
82
64
|
unicode-emoji (4.2.0)
|
|
@@ -90,7 +72,6 @@ PLATFORMS
|
|
|
90
72
|
x86_64-linux
|
|
91
73
|
|
|
92
74
|
DEPENDENCIES
|
|
93
|
-
benchmark-ips
|
|
94
75
|
bundler (~> 4.0)
|
|
95
76
|
csv
|
|
96
77
|
duckdb!
|
|
@@ -100,8 +81,6 @@ DEPENDENCIES
|
|
|
100
81
|
rubocop
|
|
101
82
|
rubocop-minitest
|
|
102
83
|
rubocop-rake
|
|
103
|
-
ruby_memcheck
|
|
104
|
-
stackprof
|
|
105
84
|
|
|
106
85
|
BUNDLED WITH
|
|
107
86
|
4.0.4
|
data/ext/duckdb/appender.c
CHANGED
|
@@ -6,9 +6,7 @@ static void deallocate(void *);
|
|
|
6
6
|
static VALUE allocate(VALUE klass);
|
|
7
7
|
static size_t memsize(const void *p);
|
|
8
8
|
|
|
9
|
-
#ifdef HAVE_DUCKDB_H_GE_V1_4_0
|
|
10
9
|
static VALUE appender_s_create_query(VALUE klass, VALUE con, VALUE query, VALUE types, VALUE table, VALUE columns);
|
|
11
|
-
#endif
|
|
12
10
|
|
|
13
11
|
static VALUE appender_initialize(VALUE klass, VALUE con, VALUE schema, VALUE table);
|
|
14
12
|
static VALUE appender_error_message(VALUE self);
|
|
@@ -61,7 +59,6 @@ static size_t memsize(const void *p) {
|
|
|
61
59
|
return sizeof(rubyDuckDBAppender);
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
#ifdef HAVE_DUCKDB_H_GE_V1_4_0
|
|
65
62
|
/* call-seq:
|
|
66
63
|
* DuckDB::Appender.create_query -> DuckDB::Appender
|
|
67
64
|
*
|
|
@@ -122,7 +119,6 @@ static VALUE appender_s_create_query(VALUE klass, VALUE con, VALUE query, VALUE
|
|
|
122
119
|
|
|
123
120
|
return appender;
|
|
124
121
|
}
|
|
125
|
-
#endif
|
|
126
122
|
|
|
127
123
|
static VALUE appender_initialize(VALUE self, VALUE con, VALUE schema, VALUE table) {
|
|
128
124
|
|
|
@@ -161,26 +157,17 @@ static VALUE appender_initialize(VALUE self, VALUE con, VALUE schema, VALUE tabl
|
|
|
161
157
|
*/
|
|
162
158
|
static VALUE appender_error_message(VALUE self) {
|
|
163
159
|
rubyDuckDBAppender *ctx;
|
|
164
|
-
#ifdef HAVE_DUCKDB_H_GE_V1_4_0
|
|
165
160
|
duckdb_error_data error_data;
|
|
166
|
-
#endif
|
|
167
161
|
const char *msg = NULL;
|
|
168
162
|
VALUE rb_msg = Qnil;
|
|
169
163
|
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
|
|
170
164
|
|
|
171
|
-
#ifdef HAVE_DUCKDB_H_GE_V1_4_0
|
|
172
165
|
error_data = duckdb_appender_error_data(ctx->appender);
|
|
173
166
|
if (duckdb_error_data_has_error(error_data)) {
|
|
174
167
|
msg = duckdb_error_data_message(error_data);
|
|
175
168
|
rb_msg = rb_str_new2(msg);
|
|
176
169
|
}
|
|
177
170
|
duckdb_destroy_error_data(&error_data);
|
|
178
|
-
#else
|
|
179
|
-
msg = duckdb_appender_error(ctx->appender);
|
|
180
|
-
if (msg != NULL) {
|
|
181
|
-
rb_msg = rb_str_new2(msg);
|
|
182
|
-
}
|
|
183
|
-
#endif
|
|
184
171
|
return rb_msg;
|
|
185
172
|
}
|
|
186
173
|
|
|
@@ -457,9 +444,7 @@ void rbduckdb_init_duckdb_appender(void) {
|
|
|
457
444
|
#endif
|
|
458
445
|
cDuckDBAppender = rb_define_class_under(mDuckDB, "Appender", rb_cObject);
|
|
459
446
|
rb_define_alloc_func(cDuckDBAppender, allocate);
|
|
460
|
-
#ifdef HAVE_DUCKDB_H_GE_V1_4_0
|
|
461
447
|
rb_define_singleton_method(cDuckDBAppender, "create_query", appender_s_create_query, 5);
|
|
462
|
-
#endif
|
|
463
448
|
rb_define_method(cDuckDBAppender, "initialize", appender_initialize, 3);
|
|
464
449
|
rb_define_method(cDuckDBAppender, "error_message", appender_error_message, 0);
|
|
465
450
|
rb_define_private_method(cDuckDBAppender, "_end_row", appender__end_row, 0);
|
data/ext/duckdb/extconf.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'mkmf'
|
|
4
4
|
|
|
5
|
-
DUCKDB_REQUIRED_VERSION = '1.
|
|
5
|
+
DUCKDB_REQUIRED_VERSION = '1.4.0'
|
|
6
6
|
|
|
7
7
|
def check_duckdb_header(header, version)
|
|
8
8
|
found = find_header(
|
|
@@ -56,14 +56,13 @@ end
|
|
|
56
56
|
dir_config('duckdb')
|
|
57
57
|
|
|
58
58
|
check_duckdb_header('duckdb.h', DUCKDB_REQUIRED_VERSION)
|
|
59
|
-
check_duckdb_library('duckdb', '
|
|
60
|
-
|
|
61
|
-
# check duckdb >= 1.3.0
|
|
62
|
-
have_func('duckdb_get_table_names', 'duckdb.h')
|
|
59
|
+
check_duckdb_library('duckdb', 'duckdb_appender_create_query', DUCKDB_REQUIRED_VERSION)
|
|
63
60
|
|
|
64
61
|
# check duckdb >= 1.4.0
|
|
65
62
|
have_func('duckdb_appender_create_query', 'duckdb.h')
|
|
66
63
|
|
|
64
|
+
have_func('duckdb_unsafe_vector_assign_string_element_len', 'duckdb.h')
|
|
65
|
+
|
|
67
66
|
$CFLAGS << ' -DDUCKDB_API_NO_DEPRECATED' if ENV['DUCKDB_API_NO_DEPRECATED']
|
|
68
67
|
|
|
69
68
|
create_makefile('duckdb/duckdb_native')
|
data/ext/duckdb/ruby-duckdb.h
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
#include "ruby/thread.h"
|
|
9
9
|
#include <duckdb.h>
|
|
10
10
|
|
|
11
|
-
#ifdef
|
|
12
|
-
#define
|
|
11
|
+
#ifdef HAVE_DUCKDB_UNSAFE_VECTOR_ASSIGN_STRING_ELEMENT_LEN
|
|
12
|
+
#define HAVE_DUCKDB_H_GE_V1_5_0 1
|
|
13
13
|
#endif
|
|
14
14
|
|
|
15
15
|
#include "./error.h"
|
data/lib/duckdb/connection.rb
CHANGED
|
@@ -65,27 +65,6 @@ module DuckDB
|
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
# executes sql with args asynchronously and provides streaming result.
|
|
69
|
-
# The first argument sql must be SQL string.
|
|
70
|
-
# The rest arguments are parameters of SQL string.
|
|
71
|
-
# This method returns DuckDB::PendingResult object.
|
|
72
|
-
#
|
|
73
|
-
# require 'duckdb'
|
|
74
|
-
# db = DuckDB::Database.open('duckdb_file')
|
|
75
|
-
# con = db.connect
|
|
76
|
-
#
|
|
77
|
-
# sql = 'SELECT * FROM users WHERE name = $name AND email = $email'
|
|
78
|
-
# pending_result = con.async_query_stream(sql, name: 'Dave', email: 'dave@example.com')
|
|
79
|
-
#
|
|
80
|
-
# pending_result.execute_task while pending_result.state == :not_ready
|
|
81
|
-
# result = pending_result.execute_pending
|
|
82
|
-
# result.each.first
|
|
83
|
-
def async_query_stream(sql, *, **)
|
|
84
|
-
warn("`#{self.class}#{__method__}` will be deprecated. Use `#{self.class}#async_query` instead.")
|
|
85
|
-
|
|
86
|
-
async_query(sql, *, **)
|
|
87
|
-
end
|
|
88
|
-
|
|
89
68
|
# connects DuckDB database
|
|
90
69
|
# The first argument is DuckDB::Database object
|
|
91
70
|
def connect(db)
|
|
@@ -51,11 +51,6 @@ module DuckDB
|
|
|
51
51
|
PendingResult.new(self)
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
def pending_prepared_stream
|
|
55
|
-
warn("`#{self.class}##{__method__}` will be deprecated. use `#{self.class}#pending_prepared` instead")
|
|
56
|
-
pending_prepared
|
|
57
|
-
end
|
|
58
|
-
|
|
59
54
|
# returns statement type. The return value is one of the following symbols:
|
|
60
55
|
# :invalid, :select, :insert, :update, :explain, :delete, :prepare, :create,
|
|
61
56
|
# :execute, :alter, :transaction, :copy, :analyze, :variable_set, :create_func,
|
data/lib/duckdb/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: duckdb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Masaki Suketa
|
|
@@ -51,7 +51,6 @@ files:
|
|
|
51
51
|
- LICENSE
|
|
52
52
|
- README.md
|
|
53
53
|
- Rakefile
|
|
54
|
-
- benchmark/async_query.rb
|
|
55
54
|
- benchmark/converter_hugeint_ips.rb
|
|
56
55
|
- benchmark/get_converter_module_ips.rb
|
|
57
56
|
- benchmark/to_intern_ips.rb
|
|
@@ -138,7 +137,6 @@ files:
|
|
|
138
137
|
- lib/duckdb/vector.rb
|
|
139
138
|
- lib/duckdb/version.rb
|
|
140
139
|
- sample/async_query.rb
|
|
141
|
-
- sample/async_query_stream.rb
|
|
142
140
|
- sample/issue922.rb
|
|
143
141
|
- sample/issue922_benchmark.rb
|
|
144
142
|
- sample/issue930.rb
|
data/benchmark/async_query.rb
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
require 'bundler/setup'
|
|
2
|
-
require 'duckdb'
|
|
3
|
-
require 'benchmark/ips'
|
|
4
|
-
|
|
5
|
-
DuckDB::Database.open do |db|
|
|
6
|
-
db.connect do |con|
|
|
7
|
-
con.query('SET threads=1')
|
|
8
|
-
con.query('CREATE TABLE tbl as SELECT range a, mod(range, 10) b FROM range(100000)')
|
|
9
|
-
con.query('CREATE TABLE tbl2 as SELECT range a, mod(range, 10) b FROM range(100000)')
|
|
10
|
-
query_sql = 'SELECT * FROM tbl where b = (SELECT min(b) FROM tbl2)'
|
|
11
|
-
print <<~END_OF_HEAD
|
|
12
|
-
|
|
13
|
-
Benchmark: Get first record ======================================
|
|
14
|
-
END_OF_HEAD
|
|
15
|
-
|
|
16
|
-
Benchmark.ips do |x|
|
|
17
|
-
x.report('async_query') do
|
|
18
|
-
pending_result = con.async_query(query_sql)
|
|
19
|
-
|
|
20
|
-
pending_result.execute_task while pending_result.state == :not_ready
|
|
21
|
-
result = pending_result.execute_pending
|
|
22
|
-
result.each.first
|
|
23
|
-
end
|
|
24
|
-
x.report('query') do
|
|
25
|
-
result = con.query(query_sql)
|
|
26
|
-
result.each.first
|
|
27
|
-
end
|
|
28
|
-
x.report('async_query_stream') do
|
|
29
|
-
pending_result = con.async_query_stream(query_sql)
|
|
30
|
-
|
|
31
|
-
pending_result.execute_task while pending_result.state == :not_ready
|
|
32
|
-
result = pending_result.execute_pending
|
|
33
|
-
result.each.first
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
print <<~END_OF_HEAD
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
Benchmark: Get all records ======================================
|
|
41
|
-
END_OF_HEAD
|
|
42
|
-
|
|
43
|
-
Benchmark.ips do |x|
|
|
44
|
-
x.report('async_query') do
|
|
45
|
-
pending_result = con.async_query(query_sql)
|
|
46
|
-
|
|
47
|
-
pending_result.execute_task while pending_result.state == :not_ready
|
|
48
|
-
result = pending_result.execute_pending
|
|
49
|
-
result.each.to_a
|
|
50
|
-
end
|
|
51
|
-
x.report('query') do
|
|
52
|
-
result = con.query(query_sql)
|
|
53
|
-
result.each.to_a
|
|
54
|
-
end
|
|
55
|
-
x.report('async_query_stream') do
|
|
56
|
-
pending_result = con.async_query_stream(query_sql)
|
|
57
|
-
|
|
58
|
-
pending_result.execute_task while pending_result.state == :not_ready
|
|
59
|
-
result = pending_result.execute_pending
|
|
60
|
-
result.each.to_a
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
__END__
|
|
67
|
-
|
|
68
|
-
results:
|
|
69
|
-
Benchmark: Get first record ======================================
|
|
70
|
-
Warming up --------------------------------------
|
|
71
|
-
async_query 70.000 i/100ms
|
|
72
|
-
query 88.000 i/100ms
|
|
73
|
-
async_query_stream 188.000 i/100ms
|
|
74
|
-
Calculating -------------------------------------
|
|
75
|
-
async_query 847.191 (± 4.6%) i/s - 4.270k in 5.051650s
|
|
76
|
-
query 850.509 (± 3.8%) i/s - 4.312k in 5.078167s
|
|
77
|
-
async_query_stream 1.757k (± 7.3%) i/s - 8.836k in 5.057142s
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Benchmark: Get all records ======================================
|
|
81
|
-
Warming up --------------------------------------
|
|
82
|
-
async_query 40.000 i/100ms
|
|
83
|
-
query 40.000 i/100ms
|
|
84
|
-
async_query_stream 39.000 i/100ms
|
|
85
|
-
Calculating -------------------------------------
|
|
86
|
-
async_query 402.567 (± 0.5%) i/s - 2.040k in 5.067639s
|
|
87
|
-
query 406.632 (± 0.7%) i/s - 2.040k in 5.017079s
|
|
88
|
-
async_query_stream 395.532 (± 0.8%) i/s - 1.989k in 5.028955s
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'duckdb'
|
|
4
|
-
|
|
5
|
-
DuckDB::Database.open do |db|
|
|
6
|
-
db.connect do |con|
|
|
7
|
-
con.query('SET threads=1')
|
|
8
|
-
con.query('CREATE TABLE tbl as SELECT range a, mod(range, 10) b FROM range(10000)')
|
|
9
|
-
con.query('CREATE TABLE tbl2 as SELECT range a, mod(range, 10) b FROM range(10000)')
|
|
10
|
-
# con.query('SET ENABLE_PROGRESS_BAR=true')
|
|
11
|
-
# con.query('SET ENABLE_PROGRESS_BAR_PRINT=false')
|
|
12
|
-
pending_result = con.async_query_stream('SELECT * FROM tbl where b = (SELECT min(b) FROM tbl2)')
|
|
13
|
-
|
|
14
|
-
# con.interrupt
|
|
15
|
-
while pending_result.state == :not_ready
|
|
16
|
-
pending_result.execute_task
|
|
17
|
-
print '.'
|
|
18
|
-
$stdout.flush
|
|
19
|
-
sleep 0.01
|
|
20
|
-
end
|
|
21
|
-
result = pending_result.execute_pending
|
|
22
|
-
puts
|
|
23
|
-
p result.each.first
|
|
24
|
-
end
|
|
25
|
-
end
|