duckdb 1.4.3.0 → 1.4.4.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/copilot-instructions.md +169 -0
- data/.github/workflows/linter.yml +30 -0
- data/.github/workflows/test_on_macos.yml +7 -2
- data/.github/workflows/test_on_ubuntu.yml +7 -2
- data/.github/workflows/test_on_windows.yml +8 -3
- data/.rubocop.yml +34 -0
- data/CHANGELOG.md +71 -0
- data/Dockerfile +2 -2
- data/Gemfile +12 -0
- data/Gemfile.lock +65 -12
- data/Rakefile +8 -6
- data/bin/console +4 -3
- data/duckdb.gemspec +2 -6
- data/ext/duckdb/bind_info.c +243 -0
- data/ext/duckdb/bind_info.h +13 -0
- data/ext/duckdb/connection.c +60 -2
- data/ext/duckdb/connection.h +1 -0
- data/ext/duckdb/data_chunk.c +137 -0
- data/ext/duckdb/data_chunk.h +13 -0
- data/ext/duckdb/duckdb.c +7 -0
- data/ext/duckdb/function_info.c +65 -0
- data/ext/duckdb/function_info.h +13 -0
- data/ext/duckdb/init_info.c +65 -0
- data/ext/duckdb/init_info.h +13 -0
- data/ext/duckdb/logical_type.c +42 -0
- data/ext/duckdb/memory_helper.c +339 -0
- data/ext/duckdb/memory_helper.h +8 -0
- data/ext/duckdb/result.c +8 -9
- data/ext/duckdb/result.h +1 -0
- data/ext/duckdb/ruby-duckdb.h +7 -0
- data/ext/duckdb/scalar_function.c +336 -1
- data/ext/duckdb/scalar_function.h +2 -0
- data/ext/duckdb/table_function.c +403 -0
- data/ext/duckdb/table_function.h +16 -0
- data/ext/duckdb/vector.c +201 -0
- data/ext/duckdb/vector.h +13 -0
- data/lib/duckdb/appender.rb +21 -11
- data/lib/duckdb/bind_info.rb +32 -0
- data/lib/duckdb/casting.rb +35 -0
- data/lib/duckdb/connection.rb +123 -2
- data/lib/duckdb/converter.rb +32 -47
- data/lib/duckdb/data_chunk.rb +114 -0
- data/lib/duckdb/extracted_statements.rb +1 -1
- data/lib/duckdb/function_info.rb +21 -0
- data/lib/duckdb/init_info.rb +22 -0
- data/lib/duckdb/instance_cache.rb +0 -4
- data/lib/duckdb/interval.rb +1 -1
- data/lib/duckdb/logical_type.rb +46 -5
- data/lib/duckdb/prepared_statement.rb +22 -8
- data/lib/duckdb/result.rb +1 -0
- data/lib/duckdb/scalar_function.rb +119 -0
- data/lib/duckdb/table_function.rb +191 -0
- data/lib/duckdb/vector.rb +20 -0
- data/lib/duckdb/version.rb +1 -1
- data/lib/duckdb.rb +8 -0
- data/sample/async_query.rb +2 -0
- data/sample/async_query_stream.rb +2 -0
- data/sample/issue922.rb +54 -0
- data/sample/issue922_benchmark.rb +169 -0
- data/sample/issue930.rb +49 -0
- data/sample/issue930_benchmark.rb +70 -0
- metadata +30 -57
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea3ed27ba341bd42ef41de91cb6b2e17ba698171e9091e0d093ffb65c04e9d0d
|
|
4
|
+
data.tar.gz: 8258d0a99bc28e1d40f206a7e0dd38aaf22978e6a0fb057a2e85761f9b7300be
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 639c83b305abc90051cf873226788a7e3bbc5b9b8fec2983e15956753b92d48e2d23972bf9f964025cf0ab85b408d5e70ba660bd206d6804ee0e7865057ce847
|
|
7
|
+
data.tar.gz: ac75dde73c78930be58d7bb79440c357e62eda7401a82c645a84724a3ca8e749fb157e683b88fbbefcae34dd04689feaad579bef059813e513dec3226634b997
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Copilot Instructions for ruby-duckdb
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
This is a Ruby binding for the DuckDB database engine, implemented as a native C extension. The gem wraps DuckDB's C API to provide idiomatic Ruby interfaces for database operations.
|
|
6
|
+
|
|
7
|
+
## Build, Test, and Lint
|
|
8
|
+
|
|
9
|
+
### Building
|
|
10
|
+
```bash
|
|
11
|
+
# Build the C extension
|
|
12
|
+
rake compile
|
|
13
|
+
|
|
14
|
+
# Clean and rebuild
|
|
15
|
+
rake clobber compile
|
|
16
|
+
|
|
17
|
+
# Build with custom DuckDB paths (if needed)
|
|
18
|
+
rake build -- --with-duckdb-include=/path/to/headers --with-duckdb-lib=/path/to/lib
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Testing
|
|
22
|
+
```bash
|
|
23
|
+
# Run all tests
|
|
24
|
+
rake test
|
|
25
|
+
|
|
26
|
+
# Run a single test file
|
|
27
|
+
ruby -Ilib:test test/duckdb_test/connection_test.rb
|
|
28
|
+
|
|
29
|
+
# Run with memory leak detection (if ruby_memcheck is installed)
|
|
30
|
+
rake test:valgrind
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Linting
|
|
34
|
+
```bash
|
|
35
|
+
# Run RuboCop
|
|
36
|
+
rubocop
|
|
37
|
+
|
|
38
|
+
# Auto-fix issues
|
|
39
|
+
rubocop -a
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Architecture
|
|
43
|
+
|
|
44
|
+
### C Extension Layer (`ext/duckdb/`)
|
|
45
|
+
- **Entry point**: `duckdb.c` - Defines the `DuckDB` module and initializes all Ruby classes
|
|
46
|
+
- **Core components**: Each DuckDB concept has paired `.c` and `.h` files:
|
|
47
|
+
- `database.{c,h}` - Database connection management
|
|
48
|
+
- `connection.{c,h}` - Query execution and connection operations
|
|
49
|
+
- `result.{c,h}` - Query result handling
|
|
50
|
+
- `prepared_statement.{c,h}` - Prepared statement API
|
|
51
|
+
- `appender.{c,h}` - High-performance bulk inserts
|
|
52
|
+
- `config.{c,h}` - DuckDB configuration options
|
|
53
|
+
- `pending_result.{c,h}` - Async query support
|
|
54
|
+
- `scalar_function.{c,h}` - User-defined functions
|
|
55
|
+
- `logical_type.{c,h}` - Type information
|
|
56
|
+
- `column.{c,h}` - Column metadata
|
|
57
|
+
- **Support modules**:
|
|
58
|
+
- `converter.{c,h}` and `value_impl.{c,h}` - Convert between Ruby and DuckDB types
|
|
59
|
+
- `error.{c,h}` - Error handling
|
|
60
|
+
- `blob.{c,h}` - Binary data support
|
|
61
|
+
- `instance_cache.{c,h}` - Object lifecycle management
|
|
62
|
+
- `util.{c,h}` - Helper functions
|
|
63
|
+
- **Build config**: `extconf.rb` - Checks for DuckDB >= 1.3.0, searches standard locations for headers/libs
|
|
64
|
+
|
|
65
|
+
### Ruby Layer (`lib/duckdb/`)
|
|
66
|
+
- Thin wrappers around C extension classes
|
|
67
|
+
- `duckdb.rb` - Main entry point, requires all components
|
|
68
|
+
- Ruby files provide:
|
|
69
|
+
- Block-based interfaces (e.g., `Database.open { |db| ... }`)
|
|
70
|
+
- Argument handling (bind parameters)
|
|
71
|
+
- Higher-level conveniences on top of C primitives
|
|
72
|
+
- Key classes mirror C extension: `Database`, `Connection`, `Result`, `PreparedStatement`, `Appender`, `Config`, `PendingResult`
|
|
73
|
+
|
|
74
|
+
### Data Flow
|
|
75
|
+
1. Ruby method call → Ruby wrapper (`lib/duckdb/*.rb`)
|
|
76
|
+
2. Ruby wrapper → C extension (`ext/duckdb/*.c`)
|
|
77
|
+
3. C extension → DuckDB C API (via `libduckdb.so`)
|
|
78
|
+
4. Response converted back through `converter.c` / `value_impl.c`
|
|
79
|
+
|
|
80
|
+
## Key Conventions
|
|
81
|
+
|
|
82
|
+
### Memory Management
|
|
83
|
+
- C objects (Database, Connection, PreparedStatement, Appender, Config) must be explicitly destroyed or use block form
|
|
84
|
+
- Block form (e.g., `db.connect { |con| ... }`) ensures automatic cleanup
|
|
85
|
+
- Manual cleanup: call `.destroy` method when done
|
|
86
|
+
- `instance_cache.c` tracks Ruby object → C pointer mappings to prevent double-free
|
|
87
|
+
|
|
88
|
+
### Parameter Binding
|
|
89
|
+
- Positional: `query('SELECT * FROM users WHERE id = ?', 1)`
|
|
90
|
+
- Named: `query('SELECT * FROM users WHERE id = $id', id: 1)`
|
|
91
|
+
- `PreparedStatement` uses same binding interface
|
|
92
|
+
|
|
93
|
+
### Type Conversion
|
|
94
|
+
- Ruby → DuckDB handled by `value_impl.c` / `converter.c`
|
|
95
|
+
- BLOB columns require `DuckDB::Blob.new(data)` or `string.force_encoding(Encoding::BINARY)`
|
|
96
|
+
- Special values: `DuckDB::Infinity::POSITIVE`, `DuckDB::Infinity::NEGATIVE`
|
|
97
|
+
- Interval types supported via `DuckDB::Interval`
|
|
98
|
+
|
|
99
|
+
### Testing
|
|
100
|
+
- Framework: Minitest
|
|
101
|
+
- Test files in `test/duckdb_test/` named `*_test.rb`
|
|
102
|
+
- Test helper: `test/test_helper.rb`
|
|
103
|
+
- Tests use in-memory databases: `DuckDB::Database.open` (no args)
|
|
104
|
+
- Each test typically creates fresh database/connection to avoid state leakage
|
|
105
|
+
|
|
106
|
+
### C Extension Development
|
|
107
|
+
- All C symbols prefixed with `rbduckdb_` to avoid namespace conflicts
|
|
108
|
+
- Header guards use pattern `RUBY_DUCKDB_<NAME>_H`
|
|
109
|
+
- Ruby objects created via `rb_define_class_under(mDuckDB, ...)`
|
|
110
|
+
- VALUE type used for all Ruby objects
|
|
111
|
+
- Use `rb_raise` for errors, wrapped in `error.c` helpers
|
|
112
|
+
|
|
113
|
+
### Ruby Code Style
|
|
114
|
+
- Frozen string literals: `# frozen_string_literal: true` at top of all files
|
|
115
|
+
- Line length: 120 characters max
|
|
116
|
+
- Target Ruby version: 3.2+
|
|
117
|
+
- Documentation: Inline for complex Ruby logic; C functions use comment blocks with `call-seq:`
|
|
118
|
+
- RuboCop config excludes C extension, benchmarks, vendor, tmp, pkg
|
|
119
|
+
|
|
120
|
+
### Version Management
|
|
121
|
+
- Gem version: `lib/duckdb/version.rb` (`DuckDB::VERSION`)
|
|
122
|
+
- Library version: Dynamically retrieved from DuckDB via `DuckDB.library_version`
|
|
123
|
+
- Minimum DuckDB: 1.3.0 (enforced in `extconf.rb`)
|
|
124
|
+
- Minimum Ruby: 3.2.0 (in gemspec)
|
|
125
|
+
|
|
126
|
+
### Performance
|
|
127
|
+
- Use `Appender` for bulk inserts (10-50x faster than prepared statements)
|
|
128
|
+
- Prepared statements for repeated queries with different parameters
|
|
129
|
+
- Async queries via `PendingResult` for long-running operations
|
|
130
|
+
|
|
131
|
+
## Development Workflow
|
|
132
|
+
|
|
133
|
+
1. Make changes to C extension (`ext/duckdb/`) and/or Ruby layer (`lib/duckdb/`)
|
|
134
|
+
2. Run `rake compile` to rebuild C extension
|
|
135
|
+
3. Write tests in `test/duckdb_test/`
|
|
136
|
+
4. Run `rake test` to ensure all tests pass
|
|
137
|
+
5. Run `rubocop` to check Ruby style (C code excluded)
|
|
138
|
+
6. Update `CHANGELOG.md` if adding features or fixing bugs
|
|
139
|
+
|
|
140
|
+
### Docker Development
|
|
141
|
+
```bash
|
|
142
|
+
# Build and run container (Ubuntu)
|
|
143
|
+
docker compose build ubuntu
|
|
144
|
+
docker compose run --rm ubuntu bash
|
|
145
|
+
|
|
146
|
+
# Custom Ruby/DuckDB versions
|
|
147
|
+
docker compose build ubuntu --build-arg RUBY_VERSION=3.1.3 --build-arg DUCKDB_VERSION=1.0.0
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Common Tasks
|
|
151
|
+
|
|
152
|
+
### Adding a New DuckDB API
|
|
153
|
+
1. Add C implementation in `ext/duckdb/<feature>.{c,h}`
|
|
154
|
+
2. Register with Ruby in `Init_duckdb_native()` (in `duckdb.c`)
|
|
155
|
+
3. Add Ruby wrapper in `lib/duckdb/<feature>.rb`
|
|
156
|
+
4. Require in `lib/duckdb.rb`
|
|
157
|
+
5. Add tests in `test/duckdb_test/<feature>_test.rb`
|
|
158
|
+
|
|
159
|
+
### Debugging C Extension
|
|
160
|
+
```bash
|
|
161
|
+
# Build with debug symbols
|
|
162
|
+
rake compile
|
|
163
|
+
|
|
164
|
+
# Run with valgrind (if ruby_memcheck installed)
|
|
165
|
+
rake test:valgrind
|
|
166
|
+
|
|
167
|
+
# Check for memory leaks in specific test
|
|
168
|
+
ruby -Ilib:test test/duckdb_test/your_test.rb
|
|
169
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Linter
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
types:
|
|
9
|
+
- opened
|
|
10
|
+
- synchronize
|
|
11
|
+
- reopened
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
rubocop:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Ruby
|
|
24
|
+
uses: ruby/setup-ruby@v1
|
|
25
|
+
with:
|
|
26
|
+
ruby-version: '3.3'
|
|
27
|
+
bundler-cache: true
|
|
28
|
+
|
|
29
|
+
- name: Run RuboCop
|
|
30
|
+
run: bundle exec rubocop
|
|
@@ -10,13 +10,18 @@ on:
|
|
|
10
10
|
- synchronize
|
|
11
11
|
- reopened
|
|
12
12
|
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
13
17
|
jobs:
|
|
14
18
|
test:
|
|
15
19
|
runs-on: macos-latest
|
|
20
|
+
timeout-minutes: 120
|
|
16
21
|
strategy:
|
|
17
22
|
matrix:
|
|
18
|
-
ruby: ['3.2.9', '3.3.10', '3.4.8', '4.0.
|
|
19
|
-
duckdb: ['1.4.
|
|
23
|
+
ruby: ['3.2.9', '3.3.10', '3.4.8', '4.0.1', 'head']
|
|
24
|
+
duckdb: ['1.4.4', '1.3.2']
|
|
20
25
|
|
|
21
26
|
steps:
|
|
22
27
|
- uses: actions/checkout@v4
|
|
@@ -10,13 +10,18 @@ on:
|
|
|
10
10
|
- synchronize
|
|
11
11
|
- reopened
|
|
12
12
|
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
13
17
|
jobs:
|
|
14
18
|
test:
|
|
15
19
|
runs-on: ubuntu-latest
|
|
20
|
+
timeout-minutes: 120
|
|
16
21
|
strategy:
|
|
17
22
|
matrix:
|
|
18
|
-
ruby: ['3.2.9', '3.3.10', '3.4.8', '4.0.
|
|
19
|
-
duckdb: ['1.4.
|
|
23
|
+
ruby: ['3.2.9', '3.3.10', '3.4.8', '4.0.1', 'head']
|
|
24
|
+
duckdb: ['1.4.4', '1.3.2']
|
|
20
25
|
|
|
21
26
|
steps:
|
|
22
27
|
- uses: actions/checkout@v4
|
|
@@ -10,13 +10,18 @@ on:
|
|
|
10
10
|
- synchronize
|
|
11
11
|
- reopened
|
|
12
12
|
|
|
13
|
+
concurrency:
|
|
14
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
13
17
|
jobs:
|
|
14
18
|
test:
|
|
15
19
|
runs-on: windows-latest
|
|
20
|
+
timeout-minutes: 10
|
|
16
21
|
strategy:
|
|
17
22
|
matrix:
|
|
18
|
-
ruby: ['3.2.9', '3.3.10', '3.4.8', 'ucrt', 'mingw', 'mswin', 'head']
|
|
19
|
-
duckdb: ['1.4.
|
|
23
|
+
ruby: ['3.2.9', '3.3.10', '3.4.8', '4.0.1', 'ucrt', 'mingw', 'mswin', 'head']
|
|
24
|
+
duckdb: ['1.4.4', '1.3.2']
|
|
20
25
|
|
|
21
26
|
steps:
|
|
22
27
|
- uses: actions/checkout@v4
|
|
@@ -47,7 +52,7 @@ jobs:
|
|
|
47
52
|
|
|
48
53
|
- name: rake test
|
|
49
54
|
run: |
|
|
50
|
-
rake test
|
|
55
|
+
bundle exec rake test TESTOPTS="--verbose"
|
|
51
56
|
|
|
52
57
|
post-test:
|
|
53
58
|
name: All tests passed on Windows
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-minitest
|
|
3
|
+
- rubocop-rake
|
|
4
|
+
|
|
5
|
+
AllCops:
|
|
6
|
+
NewCops: enable
|
|
7
|
+
TargetRubyVersion: 3.2
|
|
8
|
+
Exclude:
|
|
9
|
+
- 'vendor/**/*'
|
|
10
|
+
- 'tmp/**/*'
|
|
11
|
+
- 'pkg/**/*'
|
|
12
|
+
- 'ext/**/*'
|
|
13
|
+
- 'benchmark/**/*'
|
|
14
|
+
|
|
15
|
+
Metrics/BlockLength:
|
|
16
|
+
Exclude:
|
|
17
|
+
- 'test/**/*'
|
|
18
|
+
- 'duckdb.gemspec'
|
|
19
|
+
|
|
20
|
+
Metrics/ClassLength:
|
|
21
|
+
Exclude:
|
|
22
|
+
- 'test/**/*_test.rb'
|
|
23
|
+
- 'lib/duckdb/prepared_statement.rb'
|
|
24
|
+
- 'lib/duckdb/appender.rb'
|
|
25
|
+
|
|
26
|
+
Metrics/ModuleLength:
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'lib/duckdb/converter.rb'
|
|
29
|
+
|
|
30
|
+
Style/Documentation:
|
|
31
|
+
Enabled: false
|
|
32
|
+
|
|
33
|
+
Layout/LineLength:
|
|
34
|
+
Max: 120
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,77 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
# Unreleased
|
|
6
6
|
|
|
7
|
+
# 1.4.4.0 - 2026-03-07
|
|
8
|
+
- `DuckDB::DataChunk#set_value` accepts date.
|
|
9
|
+
- add `DuckDB::LogicalType.create_array` to create an array logical type
|
|
10
|
+
- add `DuckDB::LogicalType.create_list` to create a list logical type.
|
|
11
|
+
- `DuckDB::BindInfo#add_result_column` accepts symbols as column, column type argument.
|
|
12
|
+
- add `DuckDB::LogicalType.resolve`.
|
|
13
|
+
- add `DuckDB.cast`.
|
|
14
|
+
- support TIMESTAMP_TZ column writing Ruby Time object in `DuckDB::DataChunk#set_value`.
|
|
15
|
+
- add `DuckDB::MemoryHelper.write_timestamp_tz` method to write a Ruby Time object as a DuckDB TIMESTAMP_TZ (microseconds since Unix epoch UTC) to raw memory.
|
|
16
|
+
- support TIMESTAMP column writing Ruby Time object in `DuckDB::DataChunk#set_value`.
|
|
17
|
+
- add `DuckDB::MemoryHelper.write_timestamp` method to write a Ruby Time object as a DuckDB timestamp to raw memory.
|
|
18
|
+
- add `DuckDB::Connection#expose_as_table` to expose a Ruby object as a queryable DuckDB table function via a registered adapter.
|
|
19
|
+
- add `DuckDB::TableFunction.add_table_adapter` to register a table adapter for a Ruby class.
|
|
20
|
+
- add `DuckDB::TableFunction.table_adapter_for` to look up a registered table adapter by class.
|
|
21
|
+
- add `DuckDB::TableFunction.create` class method for declarative table function creation
|
|
22
|
+
- Automatically sets output.size from return value
|
|
23
|
+
- Supports positional and named parameters
|
|
24
|
+
- Execute block returns row count (0 when done)
|
|
25
|
+
- Simplifies table function development with cleaner API
|
|
26
|
+
- add `DuckDB::DataChunk#set_value` method for high-level value writing with automatic type conversion.
|
|
27
|
+
- add `DuckDB::MemoryHelper` write methods for all numeric types (boolean, tinyint, smallint, utinyint, usmallint, uinteger, ubigint, float).
|
|
28
|
+
- add `DuckDB::Vector#set_validity` method to mark rows as NULL or valid.
|
|
29
|
+
- add `DuckDB::Vector#assign_string_element_len` method for BLOB data with null bytes.
|
|
30
|
+
- add `DuckDB::Vector#logical_type` method to get the column type of a vector.
|
|
31
|
+
- add `DuckDB::TableFunction` class (Phase 1: Core container).
|
|
32
|
+
- add `DuckDB::TableFunction#initialize` for standard Ruby allocation pattern.
|
|
33
|
+
- add `DuckDB::TableFunction#name=` for setting function name.
|
|
34
|
+
- add `DuckDB::TableFunction#add_parameter` for positional parameters.
|
|
35
|
+
- add `DuckDB::TableFunction#add_named_parameter` for named parameters.
|
|
36
|
+
- add `DuckDB::TableFunction#bind` for setting bind callback (Phase 2).
|
|
37
|
+
- add `DuckDB::BindInfo` class for table function bind phase (Phase 2).
|
|
38
|
+
- add `DuckDB::BindInfo#parameter_count` for getting parameter count.
|
|
39
|
+
- add `DuckDB::BindInfo#get_parameter` for accessing positional parameters.
|
|
40
|
+
- add `DuckDB::BindInfo#get_named_parameter` for accessing named parameters.
|
|
41
|
+
- add `DuckDB::BindInfo#add_result_column` for defining output schema.
|
|
42
|
+
- add `DuckDB::BindInfo#set_cardinality` for performance hints.
|
|
43
|
+
- add `DuckDB::BindInfo#set_error` for reporting bind errors.
|
|
44
|
+
- add `DuckDB::DataChunk` class for table function output data (Phase 3).
|
|
45
|
+
- add `DuckDB::DataChunk#column_count` for getting number of columns.
|
|
46
|
+
- add `DuckDB::DataChunk#size` for getting number of rows.
|
|
47
|
+
- add `DuckDB::DataChunk#size=` for setting number of rows.
|
|
48
|
+
- add `DuckDB::DataChunk#get_vector` for accessing column vectors.
|
|
49
|
+
- add `DuckDB::Vector` class for column data access (Phase 3).
|
|
50
|
+
- add `DuckDB::Vector#get_data` for raw data pointer access.
|
|
51
|
+
- add `DuckDB::Vector#get_validity` for validity mask access.
|
|
52
|
+
- add `DuckDB::Vector#assign_string_element` for writing string values.
|
|
53
|
+
- add `DuckDB::MemoryHelper` module for writing primitive values to vectors.
|
|
54
|
+
- add `DuckDB::MemoryHelper.write_bigint` for writing BIGINT values.
|
|
55
|
+
- add `DuckDB::MemoryHelper.write_integer` for writing INTEGER values.
|
|
56
|
+
- add `DuckDB::MemoryHelper.write_double` for writing DOUBLE values.
|
|
57
|
+
- add `DuckDB::TableFunction#execute` for setting execute callback (Phase 4).
|
|
58
|
+
- add `DuckDB::FunctionInfo` class for table function execution context (Phase 4).
|
|
59
|
+
- add `DuckDB::FunctionInfo#set_error` for reporting execution errors.
|
|
60
|
+
- add `DuckDB::TableFunction#init` for setting init callback (Phase 5).
|
|
61
|
+
- add `DuckDB::InitInfo` class for table function initialization context (Phase 5).
|
|
62
|
+
- add `DuckDB::InitInfo#set_error` for reporting initialization errors.
|
|
63
|
+
- add `DuckDB::Connection#register_table_function` for registering table functions (Phase 6).
|
|
64
|
+
- bump duckdb to 1.4.4 on CI.
|
|
65
|
+
- add inline style to `DuckDB::Connection#register_scalar_function` (accepts keyword arguments + block).
|
|
66
|
+
- add `DuckDB::ScalarFunction.create` class method for declarative API.
|
|
67
|
+
- add FLOAT support to `DuckDB::ScalarFunction` return type.
|
|
68
|
+
- add BOOLEAN support to `DuckDB::ScalarFunction` return type.
|
|
69
|
+
- add DOUBLE support to `DuckDB::ScalarFunction` return type.
|
|
70
|
+
- add BIGINT support to `DuckDB::ScalarFunction` return type.
|
|
71
|
+
- refactor `DuckDB::ScalarFunction` to use vector_set_value_at helper.
|
|
72
|
+
- fix `DuckDB::ScalarFunction` NULL input handling.
|
|
73
|
+
- fix `DuckDB::ScalarFunction` INTEGER output type (int32 vs int64).
|
|
74
|
+
- add `DuckDB::ScalarFunction#add_parameter`.
|
|
75
|
+
- add `DuckDB::ScalarFunction#set_return_type`.
|
|
76
|
+
- bump bundler 4.0 in duckdb.gemspec.
|
|
77
|
+
|
|
7
78
|
# 1.4.3.0 - 2026-01-10
|
|
8
79
|
- bump duckdb to 1.4.3 on CI.
|
|
9
80
|
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
source 'https://rubygems.org'
|
|
2
4
|
|
|
3
5
|
# Specify your gem's dependencies in duckdb.gemspec
|
|
4
6
|
gemspec
|
|
5
7
|
|
|
8
|
+
gem 'bundler', '~> 4.0'
|
|
9
|
+
gem 'csv'
|
|
10
|
+
gem 'minitest', '~> 6.0'
|
|
11
|
+
gem 'rake', '~> 13.0'
|
|
12
|
+
gem 'rake-compiler'
|
|
13
|
+
|
|
6
14
|
if /(linux|darwin)/ =~ RUBY_PLATFORM
|
|
7
15
|
gem 'benchmark-ips'
|
|
8
16
|
gem 'stackprof'
|
|
@@ -11,3 +19,7 @@ end
|
|
|
11
19
|
if /linux/ =~ RUBY_PLATFORM
|
|
12
20
|
gem 'ruby_memcheck'
|
|
13
21
|
end
|
|
22
|
+
|
|
23
|
+
gem 'rubocop', require: false
|
|
24
|
+
gem 'rubocop-minitest', require: false
|
|
25
|
+
gem 'rubocop-rake', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -1,36 +1,85 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
duckdb (1.4.
|
|
4
|
+
duckdb (1.4.4.0)
|
|
5
5
|
bigdecimal (>= 3.1.4)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
+
addressable (2.8.9)
|
|
11
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
12
|
+
ast (2.4.3)
|
|
10
13
|
benchmark-ips (2.14.0)
|
|
11
14
|
bigdecimal (4.0.1)
|
|
15
|
+
csv (3.3.5)
|
|
16
|
+
drb (2.2.3)
|
|
17
|
+
json (2.19.0)
|
|
18
|
+
json-schema (6.2.0)
|
|
19
|
+
addressable (~> 2.8)
|
|
20
|
+
bigdecimal (>= 3.1, < 5)
|
|
21
|
+
language_server-protocol (3.17.0.5)
|
|
22
|
+
lint_roller (1.1.0)
|
|
23
|
+
mcp (0.8.0)
|
|
24
|
+
json-schema (>= 4.1)
|
|
12
25
|
mini_portile2 (2.8.9)
|
|
13
|
-
minitest (
|
|
14
|
-
|
|
26
|
+
minitest (6.0.2)
|
|
27
|
+
drb (~> 2.0)
|
|
28
|
+
prism (~> 1.5)
|
|
29
|
+
nokogiri (1.19.1)
|
|
15
30
|
mini_portile2 (~> 2.8.2)
|
|
16
31
|
racc (~> 1.4)
|
|
17
|
-
nokogiri (1.19.
|
|
32
|
+
nokogiri (1.19.1-aarch64-linux-gnu)
|
|
18
33
|
racc (~> 1.4)
|
|
19
|
-
nokogiri (1.19.
|
|
34
|
+
nokogiri (1.19.1-arm-linux-gnu)
|
|
20
35
|
racc (~> 1.4)
|
|
21
|
-
nokogiri (1.19.
|
|
36
|
+
nokogiri (1.19.1-arm64-darwin)
|
|
22
37
|
racc (~> 1.4)
|
|
23
|
-
nokogiri (1.19.
|
|
38
|
+
nokogiri (1.19.1-x86_64-darwin)
|
|
24
39
|
racc (~> 1.4)
|
|
25
|
-
nokogiri (1.19.
|
|
40
|
+
nokogiri (1.19.1-x86_64-linux-gnu)
|
|
26
41
|
racc (~> 1.4)
|
|
42
|
+
parallel (1.27.0)
|
|
43
|
+
parser (3.3.10.2)
|
|
44
|
+
ast (~> 2.4.1)
|
|
45
|
+
racc
|
|
46
|
+
prism (1.9.0)
|
|
47
|
+
public_suffix (7.0.5)
|
|
27
48
|
racc (1.8.1)
|
|
49
|
+
rainbow (3.1.1)
|
|
28
50
|
rake (13.3.1)
|
|
29
51
|
rake-compiler (1.3.1)
|
|
30
52
|
rake
|
|
53
|
+
regexp_parser (2.11.3)
|
|
54
|
+
rubocop (1.85.1)
|
|
55
|
+
json (~> 2.3)
|
|
56
|
+
language_server-protocol (~> 3.17.0.2)
|
|
57
|
+
lint_roller (~> 1.1.0)
|
|
58
|
+
mcp (~> 0.6)
|
|
59
|
+
parallel (~> 1.10)
|
|
60
|
+
parser (>= 3.3.0.2)
|
|
61
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
62
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
63
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
64
|
+
ruby-progressbar (~> 1.7)
|
|
65
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
66
|
+
rubocop-ast (1.49.0)
|
|
67
|
+
parser (>= 3.3.7.2)
|
|
68
|
+
prism (~> 1.7)
|
|
69
|
+
rubocop-minitest (0.39.1)
|
|
70
|
+
lint_roller (~> 1.1)
|
|
71
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
72
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
|
73
|
+
rubocop-rake (0.7.1)
|
|
74
|
+
lint_roller (~> 1.1)
|
|
75
|
+
rubocop (>= 1.72.1)
|
|
76
|
+
ruby-progressbar (1.13.0)
|
|
31
77
|
ruby_memcheck (3.0.1)
|
|
32
78
|
nokogiri
|
|
33
|
-
stackprof (0.2.
|
|
79
|
+
stackprof (0.2.28)
|
|
80
|
+
unicode-display_width (3.2.0)
|
|
81
|
+
unicode-emoji (~> 4.1)
|
|
82
|
+
unicode-emoji (4.2.0)
|
|
34
83
|
|
|
35
84
|
PLATFORMS
|
|
36
85
|
aarch64-linux
|
|
@@ -42,13 +91,17 @@ PLATFORMS
|
|
|
42
91
|
|
|
43
92
|
DEPENDENCIES
|
|
44
93
|
benchmark-ips
|
|
45
|
-
bundler (~>
|
|
94
|
+
bundler (~> 4.0)
|
|
95
|
+
csv
|
|
46
96
|
duckdb!
|
|
47
|
-
minitest (~>
|
|
97
|
+
minitest (~> 6.0)
|
|
48
98
|
rake (~> 13.0)
|
|
49
99
|
rake-compiler
|
|
100
|
+
rubocop
|
|
101
|
+
rubocop-minitest
|
|
102
|
+
rubocop-rake
|
|
50
103
|
ruby_memcheck
|
|
51
104
|
stackprof
|
|
52
105
|
|
|
53
106
|
BUNDLED WITH
|
|
54
|
-
|
|
107
|
+
4.0.4
|
data/Rakefile
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'bundler/gem_tasks'
|
|
2
4
|
require 'rake/testtask'
|
|
3
5
|
ruby_memcheck_avaiable = begin
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
require 'ruby_memcheck'
|
|
7
|
+
true
|
|
8
|
+
rescue LoadError
|
|
9
|
+
false
|
|
10
|
+
end
|
|
10
11
|
|
|
11
12
|
if ruby_memcheck_avaiable
|
|
12
13
|
RubyMemcheck.config(
|
|
@@ -31,6 +32,7 @@ end
|
|
|
31
32
|
|
|
32
33
|
require 'rake/extensiontask'
|
|
33
34
|
|
|
35
|
+
desc 'Build the gem'
|
|
34
36
|
task build: :compile
|
|
35
37
|
|
|
36
38
|
Rake::ExtensionTask.new('duckdb_native') do |ext|
|
data/bin/console
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
2
3
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
4
|
+
require 'bundler/setup'
|
|
5
|
+
require 'duckdb'
|
|
5
6
|
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
|
@@ -10,5 +11,5 @@ require "duckdb"
|
|
|
10
11
|
# require "pry"
|
|
11
12
|
# Pry.start
|
|
12
13
|
|
|
13
|
-
require
|
|
14
|
+
require 'irb'
|
|
14
15
|
IRB.start(__FILE__)
|
data/duckdb.gemspec
CHANGED
|
@@ -11,7 +11,8 @@ Gem::Specification.new do |spec|
|
|
|
11
11
|
spec.email = ['masaki.suketa@nifty.ne.jp']
|
|
12
12
|
|
|
13
13
|
spec.summary = 'This module is Ruby binding for DuckDB database engine.'
|
|
14
|
-
spec.description = 'This module is Ruby binding for DuckDB database engine.
|
|
14
|
+
spec.description = 'This module is Ruby binding for DuckDB database engine. ' \
|
|
15
|
+
'You must have the DuckDB engine installed to build/use this module.'
|
|
15
16
|
spec.homepage = 'https://github.com/suketa/ruby-duckdb'
|
|
16
17
|
spec.license = 'MIT'
|
|
17
18
|
|
|
@@ -29,9 +30,4 @@ Gem::Specification.new do |spec|
|
|
|
29
30
|
spec.extensions = ['ext/duckdb/extconf.rb']
|
|
30
31
|
spec.required_ruby_version = '>= 3.2.0'
|
|
31
32
|
spec.add_dependency 'bigdecimal', '>= 3.1.4'
|
|
32
|
-
|
|
33
|
-
spec.add_development_dependency 'bundler', '~> 2.3'
|
|
34
|
-
spec.add_development_dependency 'minitest', '~> 5.0'
|
|
35
|
-
spec.add_development_dependency 'rake', '~> 13.0'
|
|
36
|
-
spec.add_development_dependency 'rake-compiler'
|
|
37
33
|
end
|