Skip to content

Rename DuckDB::BindInfo to DuckDB::TableFunction::BindInfo - #1178

Merged
suketa merged 2 commits into
mainfrom
rename-bind-info-to-table-function-bind-info
Mar 25, 2026
Merged

Rename DuckDB::BindInfo to DuckDB::TableFunction::BindInfo#1178
suketa merged 2 commits into
mainfrom
rename-bind-info-to-table-function-bind-info

Conversation

@suketa

@suketa suketa commented Mar 25, 2026

Copy link
Copy Markdown
Owner

Summary

Rename DuckDB::BindInfo to DuckDB::TableFunction::BindInfo to clarify it is specific to table functions, and to follow a more idiomatic nested Ruby naming convention.

Changes

  • Rename C/Ruby/test files to table_function/bind_info paths
  • Define DuckDB::TableFunction::BindInfo as a nested class under DuckDB::TableFunction (both in C and Ruby)
  • Expose cDuckDBTableFunction (remove static) and add extern to table_function.h
  • Rename C variable cDuckDBBindInfocDuckDBTableFunctionBindInfo
  • Add DuckDB.const_missing for backward compatibility: accessing DuckDB::BindInfo emits a deprecation warning once, then caches the constant via const_set

Breaking changes

DuckDB::BindInfo is deprecated. Use DuckDB::TableFunction::BindInfo instead.

Related

Part of #1122

Summary by CodeRabbit

  • Breaking Changes

    • DuckDB::BindInfo has been relocated to DuckDB::TableFunction::BindInfo
  • Deprecations

    • DuckDB::BindInfo now emits a deprecation warning; migrate to DuckDB::TableFunction::BindInfo. The old location remains functional as a backward-compatible alias.

suketa and others added 2 commits March 25, 2026 18:25
- Rename files: bind_info.{c,h,rb} -> table_function_bind_info.{c,h,rb}
- Rename test: bind_info_test.rb -> table_function_bind_info_test.rb
- Expose cDuckDBTableFunction (remove static) and add extern to table_function.h
- Define DuckDB::TableFunction::BindInfo as nested class in C and Ruby
- Rename C variable cDuckDBBindInfo -> cDuckDBTableFunctionBindInfo
- Update header guard to RUBY_DUCKDB_TABLE_FUNCTION_BIND_INFO_H
- Update rb_data_type_t name to 'DuckDB/TableFunctionBindInfo'
- Move bind_info init after table_function init in duckdb.c
- Add DuckDB.const_missing for backward-compat: DuckDB::BindInfo emits
  deprecation warning on first access, then caches via const_set
- Rename test class to TableFunctionBindInfoTest; add deprecation warning test
- Update CHANGELOG.md with breaking change entry

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- lib/duckdb/table_function_bind_info.rb -> lib/duckdb/table_function/bind_info.rb
- test/duckdb_test/table_function_bind_info_test.rb -> test/duckdb_test/table_function/bind_info_test.rb
- Update require path in lib/duckdb.rb

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The PR restructures the BindInfo class by moving it from the DuckDB namespace into DuckDB::TableFunction namespace. The old DuckDB::BindInfo is maintained as a deprecated alias with a warning. C extension globals, headers, initialization order, and file locations are updated to reflect this reorganization.

Changes

Cohort / File(s) Summary
Documentation & Changelog
CHANGELOG.md
Added breaking changes entry documenting the rename of DuckDB::BindInfo to DuckDB::TableFunction::BindInfo with deprecation warning for the old name.
C Extension Headers & Declarations
ext/duckdb/ruby-duckdb.h, ext/duckdb/table_function.h, ext/duckdb/table_function_bind_info.h
Updated header includes and added extern declarations for the renamed table function bind info globals: cDuckDBTableFunction and cDuckDBTableFunctionBindInfo.
C Extension Implementation
ext/duckdb/table_function.c, ext/duckdb/table_function_bind_info.c
Updated global variable names and visibility (cDuckDBTableFunction from static to exported, cDuckDBBindInfo renamed to cDuckDBTableFunctionBindInfo), changed class registration location from mDuckDB to cDuckDBTableFunction, and updated Ruby typed data type name.
C Extension Initialization
ext/duckdb/duckdb.c
Reordered initialization: moved rbduckdb_init_duckdb_bind_info() call to occur after rbduckdb_init_duckdb_table_function() instead of after rbduckdb_init_duckdb_scalar_function().
Ruby Library - Migration
lib/duckdb/bind_info.rb, lib/duckdb/table_function/bind_info.rb
Removed DuckDB::BindInfo class from original location and created it at DuckDB::TableFunction::BindInfo with identical add_result_column method implementation.
Ruby Library - Deprecation Handling
lib/duckdb.rb
Updated require statement from duckdb/bind_info to duckdb/table_function/bind_info, added const_missing hook to emit deprecation warning when DuckDB::BindInfo is accessed and define it as an alias to DuckDB::TableFunction::BindInfo.
Tests
test/duckdb_test/table_function/bind_info_test.rb
Renamed test class to TableFunctionBindInfoTest, added tests verifying the DuckDB::BindInfo alias and deprecation warning output.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 Hops with glee, the binding info hops,
From DuckDB's top shelf, to TableFunction's cozy nooks!
With deprecation warnings and aliases so neat,
Old paths still work—but greeted gently with a bleat!
Refactored and renamed, the structure is now sweet. 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main refactoring: renaming DuckDB::BindInfo to DuckDB::TableFunction::BindInfo, which matches the core objective and all file changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rename-bind-info-to-table-function-bind-info

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/duckdb_test/table_function/bind_info_test.rb (1)

142-149: Consider restoring the constant in the ensure block.

The ensure block removes BindInfo but doesn't restore it. While this works because const_missing will redefine it on next access, it could cause unexpected deprecation warnings in subsequent tests' output.

♻️ Suggested improvement
     def test_bind_info_alias_deprecation_warning
       DuckDB.send(:remove_const, :BindInfo) if DuckDB.const_defined?(:BindInfo, false)
       warning = capture_io { DuckDB::BindInfo }.last
 
       assert_match(/deprecated/, warning)
     ensure
-      DuckDB.send(:remove_const, :BindInfo) if DuckDB.const_defined?(:BindInfo, false)
+      # Restore the constant to avoid affecting other tests
+      unless DuckDB.const_defined?(:BindInfo, false)
+        DuckDB.const_set(:BindInfo, DuckDB::TableFunction::BindInfo)
+      end
     end
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/duckdb_test/table_function/bind_info_test.rb` around lines 142 - 149,
Before removing DuckDB::BindInfo, capture whether it originally existed and save
its value; then in the ensure block restore the original constant if it existed
(using DuckDB.const_set(:BindInfo, original_value)), otherwise remove any
redefined BindInfo to leave global state unchanged. Update the test method
around the DuckDB.send(:remove_const, :BindInfo) call and the ensure block to
reference the saved original_value and restore or clean up accordingly so
subsequent tests don't see extra deprecation warnings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@test/duckdb_test/table_function/bind_info_test.rb`:
- Around line 142-149: Before removing DuckDB::BindInfo, capture whether it
originally existed and save its value; then in the ensure block restore the
original constant if it existed (using DuckDB.const_set(:BindInfo,
original_value)), otherwise remove any redefined BindInfo to leave global state
unchanged. Update the test method around the DuckDB.send(:remove_const,
:BindInfo) call and the ensure block to reference the saved original_value and
restore or clean up accordingly so subsequent tests don't see extra deprecation
warnings.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: de791940-bba9-4b1a-9265-b8dc42545dee

📥 Commits

Reviewing files that changed from the base of the PR and between d71811e and b5de7a3.

📒 Files selected for processing (11)
  • CHANGELOG.md
  • ext/duckdb/duckdb.c
  • ext/duckdb/ruby-duckdb.h
  • ext/duckdb/table_function.c
  • ext/duckdb/table_function.h
  • ext/duckdb/table_function_bind_info.c
  • ext/duckdb/table_function_bind_info.h
  • lib/duckdb.rb
  • lib/duckdb/bind_info.rb
  • lib/duckdb/table_function/bind_info.rb
  • test/duckdb_test/table_function/bind_info_test.rb
💤 Files with no reviewable changes (1)
  • lib/duckdb/bind_info.rb

@suketa
suketa merged commit 26f5f37 into main Mar 25, 2026
41 checks passed
@suketa
suketa deleted the rename-bind-info-to-table-function-bind-info branch March 25, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant