duckdb 1.1.0.1 β 1.1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test_on_macos.yml +7 -7
- data/.github/workflows/test_on_ubuntu.yml +1 -1
- data/.github/workflows/test_on_windows.yml +1 -1
- data/CHANGELOG.md +5 -0
- data/Dockerfile +1 -1
- data/Gemfile.lock +2 -2
- data/ext/duckdb/connection.c +0 -8
- data/ext/duckdb/extconf.rb +7 -3
- data/ext/duckdb/result.c +7 -0
- data/ext/duckdb/ruby-duckdb.h +4 -4
- data/lib/duckdb/converter/int_to_sym.rb +39 -77
- data/lib/duckdb/converter.rb +2 -2
- data/lib/duckdb/result.rb +13 -5
- data/lib/duckdb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84935b6317fa4bef4b62197645f061b179e3358e93cba3b976672eb1988715fc
|
4
|
+
data.tar.gz: 7ff6b2f4b46ea16bcfa2e7de486e9a5bb30aa7d4dccb14e32af7b9886d6fcac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d90dbdbf57d5cc282049f6297d00674ff57d9fafbfd7bfab8db8c87fb1153d3c9ea93ceda3b440d066c24ceef5dd1e349dedea6f4b17557bda590bb92f93fc5a
|
7
|
+
data.tar.gz: cbcbd5c50c6ddc92c01001b36cbe5aad8a87729ea5518a881dcf8c21621679d1c3740c0ed97672d597aca351ea09548d6f7b5e722fde32077cb811a57c3dfd40
|
@@ -16,7 +16,7 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
matrix:
|
18
18
|
ruby: ['3.1.6', '3.2.5', '3.3.5', '3.4.0-preview1', 'head']
|
19
|
-
duckdb: ['1.1.
|
19
|
+
duckdb: ['1.1.1', '1.1.0', '1.0.0']
|
20
20
|
|
21
21
|
steps:
|
22
22
|
- uses: actions/checkout@v4
|
@@ -51,12 +51,12 @@ jobs:
|
|
51
51
|
run: |
|
52
52
|
bundle install --jobs 4 --retry 3
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
54
|
+
- name: Build test with DUCKDB_API_NO_DEPRECATED and Ruby ${{ matrix.ruby }}
|
55
|
+
env:
|
56
|
+
DUCKDB_VERSION: ${{ matrix.duckdb }}
|
57
|
+
run: |
|
58
|
+
env DUCKDB_API_NO_DEPRECATED=1 bundle exec rake build -- --with-duckdb-include=${GITHUB_WORKSPACE}/duckdb-v${DUCKDB_VERSION}/src/include --with-duckdb-lib=${GITHUB_WORKSPACE}/duckdb-v${DUCKDB_VERSION}/build/release/src/
|
59
|
+
bundle exec rake clean
|
60
60
|
|
61
61
|
- name: Build with Ruby ${{ matrix.ruby }}
|
62
62
|
env:
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
# Unreleased
|
5
5
|
|
6
|
+
# 1.1.1.0 - 2024-10-06
|
7
|
+
- bump duckdb 1.1.1.
|
8
|
+
## Breaking changes
|
9
|
+
- drop duckdb v0.10.x.
|
10
|
+
|
6
11
|
# 1.1.0.1 - 2024-09-21
|
7
12
|
- add `DuckDB::Connection#prepare`. `DuckDB::Connection#prepare` is an alias of `DuckDB::Connection#prepared_statement`.
|
8
13
|
|
data/Dockerfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
duckdb (1.1.0
|
4
|
+
duckdb (1.1.1.0)
|
5
5
|
bigdecimal (>= 3.1.4)
|
6
6
|
|
7
7
|
GEM
|
@@ -18,7 +18,7 @@ GEM
|
|
18
18
|
racc (~> 1.4)
|
19
19
|
racc (1.8.1)
|
20
20
|
rake (13.2.1)
|
21
|
-
rake-compiler (1.2.
|
21
|
+
rake-compiler (1.2.8)
|
22
22
|
rake
|
23
23
|
ruby_memcheck (3.0.0)
|
24
24
|
nokogiri
|
data/ext/duckdb/connection.c
CHANGED
@@ -106,20 +106,12 @@ static VALUE duckdb_connection_interrupt(VALUE self) {
|
|
106
106
|
*/
|
107
107
|
static VALUE duckdb_connection_query_progress(VALUE self) {
|
108
108
|
rubyDuckDBConnection *ctx;
|
109
|
-
#ifdef HAVE_DUCKDB_H_GE_V0_10_0
|
110
109
|
duckdb_query_progress_type progress;
|
111
|
-
#else
|
112
|
-
double progress;
|
113
|
-
#endif
|
114
110
|
|
115
111
|
TypedData_Get_Struct(self, rubyDuckDBConnection, &connection_data_type, ctx);
|
116
112
|
progress = duckdb_query_progress(ctx->con);
|
117
113
|
|
118
|
-
#ifdef HAVE_DUCKDB_H_GE_V0_10_0
|
119
114
|
return rb_funcall(mDuckDBConverter, rb_intern("_to_query_progress"), 3, DBL2NUM(progress.percentage), ULL2NUM(progress.rows_processed), ULL2NUM(progress.total_rows_to_process));
|
120
|
-
#else
|
121
|
-
return DBL2NUM(progress);
|
122
|
-
#endif
|
123
115
|
}
|
124
116
|
|
125
117
|
static VALUE duckdb_connection_connect(VALUE self, VALUE oDuckDBDatabase) {
|
data/ext/duckdb/extconf.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'mkmf'
|
4
4
|
|
5
|
-
DUCKDB_REQUIRED_VERSION = '0.
|
5
|
+
DUCKDB_REQUIRED_VERSION = '1.0.0'
|
6
6
|
|
7
7
|
def check_duckdb_header(header, version)
|
8
8
|
found = find_header(
|
@@ -58,8 +58,8 @@ dir_config('duckdb')
|
|
58
58
|
check_duckdb_header('duckdb.h', DUCKDB_REQUIRED_VERSION)
|
59
59
|
check_duckdb_library('duckdb', 'duckdb_appender_column_count', DUCKDB_REQUIRED_VERSION)
|
60
60
|
|
61
|
-
# check duckdb >= 0.
|
62
|
-
have_func('
|
61
|
+
# check duckdb >= 1.0.0
|
62
|
+
have_func('duckdb_fetch_chunk', 'duckdb.h')
|
63
63
|
|
64
64
|
# check duckdb >= 1.0.0
|
65
65
|
have_func('duckdb_fetch_chunk', 'duckdb.h')
|
@@ -67,6 +67,10 @@ have_func('duckdb_fetch_chunk', 'duckdb.h')
|
|
67
67
|
# check duckdb >= 1.1.0
|
68
68
|
have_func('duckdb_result_error_type', 'duckdb.h')
|
69
69
|
|
70
|
+
# Building with enabled DUCKDB_API_NO_DEPRECATED is failed with DuckDB v1.1.0 only.
|
71
|
+
# DuckDB v1.1.1 is fixed this issue https://github.com/duckdb/duckdb/issues/13872.
|
72
|
+
have_const('DUCKDB_TYPE_SQLNULL', 'duckdb.h')
|
73
|
+
|
70
74
|
$CFLAGS << ' -DDUCKDB_API_NO_DEPRECATED' if ENV['DUCKDB_API_NO_DEPRECATED']
|
71
75
|
|
72
76
|
create_makefile('duckdb/duckdb_native')
|
data/ext/duckdb/result.c
CHANGED
@@ -310,7 +310,14 @@ static VALUE duckdb_result__column_type(VALUE oDuckDBResult, VALUE col_idx) {
|
|
310
310
|
static VALUE duckdb_result__return_type(VALUE oDuckDBResult) {
|
311
311
|
rubyDuckDBResult *ctx;
|
312
312
|
TypedData_Get_Struct(oDuckDBResult, rubyDuckDBResult, &result_data_type, ctx);
|
313
|
+
/*
|
314
|
+
* remove this #if ... #else statement when dropping duckdb 1.1.0.
|
315
|
+
*/
|
316
|
+
#if !defined(HAVE_DUCKDB_H_GE_V1_1_1) && defined(HAVE_DUCKDB_H_GE_V1_1_0) && defined(DUCKDB_API_NO_DEPRECATED)
|
317
|
+
rb_raise(eDuckDBError, "duckdb_result_return_type C-API is not available with duckdb v1.1.0 with enabled DUCKDB_API_NO_DEPRECATED.");
|
318
|
+
#else
|
313
319
|
return INT2FIX(duckdb_result_return_type(ctx->result));
|
320
|
+
#endif
|
314
321
|
}
|
315
322
|
|
316
323
|
static VALUE duckdb_result__statement_type(VALUE oDuckDBResult) {
|
data/ext/duckdb/ruby-duckdb.h
CHANGED
@@ -7,10 +7,6 @@
|
|
7
7
|
#include "ruby.h"
|
8
8
|
#include <duckdb.h>
|
9
9
|
|
10
|
-
#ifdef HAVE_DUCKDB_APPENDER_COLUMN_COUNT
|
11
|
-
#define HAVE_DUCKDB_H_GE_V0_10_0 1
|
12
|
-
#endif
|
13
|
-
|
14
10
|
#ifdef HAVE_DUCKDB_FETCH_CHUNK
|
15
11
|
#define HAVE_DUCKDB_H_GE_V1_0_0 1
|
16
12
|
#endif
|
@@ -19,6 +15,10 @@
|
|
19
15
|
#define HAVE_DUCKDB_H_GE_V1_1_0 1
|
20
16
|
#endif
|
21
17
|
|
18
|
+
#ifdef HAVE_CONST_DUCKDB_TYPE_SQLNULL
|
19
|
+
#define HAVE_DUCKDB_H_GE_V1_1_1 1
|
20
|
+
#endif
|
21
|
+
|
22
22
|
#include "./error.h"
|
23
23
|
#include "./database.h"
|
24
24
|
#include "./connection.h"
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module DuckDB
|
4
4
|
module Converter
|
5
|
-
module IntToSym
|
5
|
+
module IntToSym # :nodoc: all
|
6
6
|
STATEMENT_TYPES = %i[
|
7
7
|
invalid
|
8
8
|
select
|
@@ -34,90 +34,52 @@ module DuckDB
|
|
34
34
|
multi
|
35
35
|
].freeze
|
36
36
|
|
37
|
-
HASH_TYPES =
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
else
|
74
|
-
{
|
75
|
-
0 => :invalid,
|
76
|
-
1 => :boolean,
|
77
|
-
2 => :tinyint,
|
78
|
-
3 => :smallint,
|
79
|
-
4 => :integer,
|
80
|
-
5 => :bigint,
|
81
|
-
6 => :utinyint,
|
82
|
-
7 => :usmallint,
|
83
|
-
8 => :uinteger,
|
84
|
-
9 => :ubigint,
|
85
|
-
10 => :float,
|
86
|
-
11 => :double,
|
87
|
-
12 => :timestamp,
|
88
|
-
13 => :date,
|
89
|
-
14 => :time,
|
90
|
-
15 => :interval,
|
91
|
-
16 => :hugeint,
|
92
|
-
32 => :uhugeint,
|
93
|
-
17 => :varchar,
|
94
|
-
18 => :blob,
|
95
|
-
19 => :decimal,
|
96
|
-
20 => :timestamp_s,
|
97
|
-
21 => :timestamp_ms,
|
98
|
-
22 => :timestamp_ns,
|
99
|
-
23 => :enum,
|
100
|
-
24 => :list,
|
101
|
-
25 => :struct,
|
102
|
-
26 => :map,
|
103
|
-
33 => :array,
|
104
|
-
27 => :uuid,
|
105
|
-
28 => :union,
|
106
|
-
29 => :bit,
|
107
|
-
30 => :time_tz,
|
108
|
-
31 => :timestamp_tz
|
109
|
-
}.freeze
|
110
|
-
end
|
37
|
+
HASH_TYPES = {
|
38
|
+
0 => :invalid,
|
39
|
+
1 => :boolean,
|
40
|
+
2 => :tinyint,
|
41
|
+
3 => :smallint,
|
42
|
+
4 => :integer,
|
43
|
+
5 => :bigint,
|
44
|
+
6 => :utinyint,
|
45
|
+
7 => :usmallint,
|
46
|
+
8 => :uinteger,
|
47
|
+
9 => :ubigint,
|
48
|
+
10 => :float,
|
49
|
+
11 => :double,
|
50
|
+
12 => :timestamp,
|
51
|
+
13 => :date,
|
52
|
+
14 => :time,
|
53
|
+
15 => :interval,
|
54
|
+
16 => :hugeint,
|
55
|
+
32 => :uhugeint,
|
56
|
+
17 => :varchar,
|
57
|
+
18 => :blob,
|
58
|
+
19 => :decimal,
|
59
|
+
20 => :timestamp_s,
|
60
|
+
21 => :timestamp_ms,
|
61
|
+
22 => :timestamp_ns,
|
62
|
+
23 => :enum,
|
63
|
+
24 => :list,
|
64
|
+
25 => :struct,
|
65
|
+
26 => :map,
|
66
|
+
33 => :array,
|
67
|
+
27 => :uuid,
|
68
|
+
28 => :union,
|
69
|
+
29 => :bit,
|
70
|
+
30 => :time_tz,
|
71
|
+
31 => :timestamp_tz
|
72
|
+
}.freeze
|
111
73
|
|
112
74
|
module_function
|
113
75
|
|
114
|
-
def statement_type_to_sym(val)
|
76
|
+
def statement_type_to_sym(val) # :nodoc:
|
115
77
|
raise DuckDB::Error, "Unknown statement type: #{val}" if val >= STATEMENT_TYPES.size
|
116
78
|
|
117
79
|
STATEMENT_TYPES[val]
|
118
80
|
end
|
119
81
|
|
120
|
-
def type_to_sym(val)
|
82
|
+
def type_to_sym(val) # :nodoc:
|
121
83
|
raise DuckDB::Error, "Unknown type: #{val}" unless HASH_TYPES.key?(val)
|
122
84
|
|
123
85
|
HASH_TYPES[val]
|
data/lib/duckdb/converter.rb
CHANGED
@@ -7,7 +7,7 @@ require_relative 'converter/int_to_sym'
|
|
7
7
|
module DuckDB
|
8
8
|
QueryProgress = Struct.new(:percentage, :rows_processed, :total_rows_to_process)
|
9
9
|
|
10
|
-
module Converter
|
10
|
+
module Converter # :nodoc: all
|
11
11
|
HALF_HUGEINT_BIT = 64
|
12
12
|
HALF_HUGEINT = 1 << HALF_HUGEINT_BIT
|
13
13
|
FLIP_HUGEINT = 1 << 63
|
@@ -122,7 +122,7 @@ module DuckDB
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def _to_uuid_from_vector(lower, upper)
|
125
|
-
upper
|
125
|
+
upper ^= FLIP_HUGEINT
|
126
126
|
upper += HALF_HUGEINT if upper.negative?
|
127
127
|
|
128
128
|
str = _to_hugeint_from_vector(lower, upper).to_s(16).rjust(32, '0')
|
data/lib/duckdb/result.rb
CHANGED
@@ -34,7 +34,7 @@ module DuckDB
|
|
34
34
|
raise DuckDB::Error, 'DuckDB::Result cannot be instantiated directly.'
|
35
35
|
end
|
36
36
|
|
37
|
-
def use_chunk_each=(value)
|
37
|
+
def use_chunk_each=(value) # :nodoc:
|
38
38
|
raise('`changing DuckDB::Result.use_chunk_each to false` was deprecated.') unless value
|
39
39
|
|
40
40
|
warn('`DuckDB::Result.use_chunk_each=` will be deprecated.')
|
@@ -42,21 +42,21 @@ module DuckDB
|
|
42
42
|
true
|
43
43
|
end
|
44
44
|
|
45
|
-
def use_chunk_each?
|
45
|
+
def use_chunk_each? # :nodoc:
|
46
46
|
warn('`DuckDB::Result.use_chunk_each?` will be deprecated.')
|
47
47
|
true
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def each
|
51
|
+
def each(&)
|
52
52
|
if streaming?
|
53
53
|
return _chunk_stream unless block_given?
|
54
54
|
|
55
|
-
_chunk_stream
|
55
|
+
_chunk_stream(&)
|
56
56
|
else
|
57
57
|
return chunk_each unless block_given?
|
58
58
|
|
59
|
-
chunk_each
|
59
|
+
chunk_each(&)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -91,6 +91,14 @@ module DuckDB
|
|
91
91
|
Converter::IntToSym.statement_type_to_sym(i)
|
92
92
|
end
|
93
93
|
|
94
|
+
# returns all available ENUM type values of the specified column index.
|
95
|
+
# require 'duckdb'
|
96
|
+
# db = DuckDB::Database.open('duckdb_database')
|
97
|
+
# con = db.connect
|
98
|
+
# con.execute("CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', 'πΎπΎΦ
Ι π')")
|
99
|
+
# con.execute("CREATE TABLE enums (id INTEGER, mood mood)")
|
100
|
+
# result = con.query('SELECT * FROM enums')
|
101
|
+
# result.enum_dictionary_values(1) # => ['sad', 'ok', 'happy', 'πΎπΎΦ
Ι π']
|
94
102
|
def enum_dictionary_values(col_index)
|
95
103
|
values = []
|
96
104
|
_enum_dictionary_size(col_index).times do |i|
|
data/lib/duckdb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duckdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0
|
4
|
+
version: 1.1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaki Suketa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bigdecimal
|